stdnum.iso9362

ISO 9362 (Business identifier codes).

An ISO 9362 identifier (also: BIC, BEI, or SWIFT code) uniquely identifies an institution. They are commonly used to route financial transactions.

The code consists of a 4 letter institution code, a 2 letter country code, and a 2 character location code, optionally followed by a three character branch code.

>>> validate('AGRIFRPP882')
'AGRIFRPP882'
>>> validate('AGRIFRPP')
'AGRIFRPP'
>>> validate('AGRIFRPP8')
Traceback (most recent call last):
    ...
InvalidLength: ..
>>> validate('AGRIF2PP')  # country code can't contain digits
Traceback (most recent call last):
    ...
InvalidFormat: ..
>>> format('agriFRPP')  # conventionally caps
'AGRIFRPP'
Traceback (most recent call last):
    ...
InvalidFormat: ..
stdnum.iso9362.compact(number)

Convert the number to the minimal representation. This strips the number of any surrounding whitespace.

stdnum.iso9362.format(number)

Reformat the passed number to the standard format.

stdnum.iso9362.is_valid(number)

Checks to see if the number provided is a valid BIC. This checks the length and characters in each position.

stdnum.iso9362.validate(number)

Checks to see if the number provided is a valid routing number. This checks the length and characters in each position.

Previous topic

stdnum.iso6346

Next topic

stdnum.issn