# stdnum.lei

LEI (Legal Entity Identifier).

The Legal Entity Identifier (LEI) is used to identify legal entities for use in financial transactions. A LEI is a 20-character alphanumeric string that consists of a 4-character issuing LOU (Local Operating Unit), 2 digits that are often 0, 13 digits to identify the organisation and 2 check digits.

More information:

- https://en.wikipedia.org/wiki/Legal_Entity_Identifier

- https://www.lei-lookup.com/

- https://www.gleif.org/

- http://openleis.com/

    >>> validate('213800KUD8LAJWSQ9D15')
    '213800KUD8LAJWSQ9D15'
    >>> validate('213800KUD8LXJWSQ9D15')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...

stdnum.lei.compact(number: str) → str

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding white space.

stdnum.lei.is_valid(number: str) → bool

  Check if the number is valid.

stdnum.lei.validate(number: str) → str

  Check if the number is valid. This checks the length, format and check digits.