API

iso6346.normalize(s)

Normalise an ISO 6346 owner number for database storage.

Remove any non-alphanumeric characters and convert to upper-case.

iso6346.format(s, box=False)

Nicely format an ISO 6346 owner number.

iso6346.validate(s)

Validate ISO 6346 owner number.

This will validate a given CSC owner number by calculating the checkdigit and comparing it against the last character in the string.

All 11 characters exactly must be provided.

Will return the True if valid.

Otherwise, will raise an InvalidOwnerCodeError exception if invalid.

iso6346.checkdigit(s)

Calculate ISO 6346 checkdigit.

This will calculate the checkdigit given the first 10 characters of a CSC owner number. The 11th character is optional.