# stdnum.us.rtn

RTN (Routing transport number).

The routing transport number is a nine digit number used in the US banking system for processing deposits between banks.

The last digit is a checksum.

    >>> calc_check_digit('11100002')
    '5'
    >>> validate('111000025')
    '111000025'
    >>> validate('11100002')  # Not nine digits
    Traceback (most recent call last):
        ...
    InvalidLength: ..
    >>> validate('11100002B')  # Not all numeric
    Traceback (most recent call last):
        ...
    InvalidFormat: ..
    >>> validate('112000025')  # bad checksum
    Traceback (most recent call last):
        ...
    InvalidChecksum: ..

stdnum.us.rtn.calc_check_digit(number)

  Calculate the check digit. The number passed should not have the check digit included.

stdnum.us.rtn.compact(number)

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

stdnum.us.rtn.is_valid(number)

  Check if the number is a valid RTN.

stdnum.us.rtn.validate(number)

  Check if the number is a valid routing number. This checks the length and check digit.