#NEWLINE# @ validator #NEWLINE# def fi_business_id( business_id ) : #NEWLINE# #INDENT# "\n    Validate a Finnish Business ID.\n\n    Each company in Finland has a distinct business id. For more\n    information see `Finnish Trade Register`_\n\n    .. _Finnish Trade Register:\n        http://en.wikipedia.org/wiki/Finnish_Trade_Register\n\n    Examples::\n\n        >>> fi_business_id('0112038-9')  # Fast Monkeys Ltd\n        True\n\n        >>> fi_business_id('1234567-8')  # Bogus ID\n        ValidationFailure(func=fi_business_id, ...)\n\n    .. versionadded:: 0.4\n    .. versionchanged:: 0.5\n        Method renamed from ``finnish_business_id`` to ``fi_business_id``\n\n    :param business_id: business_id to validate\n    " #NEWLINE# if ( ( not business_id ) or ( not re . match ( business_id_pattern , business_id ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# factors = [ 7 , 9 , 10 , 5 , 8 , 4 , 2 ] #NEWLINE# numbers = map ( int , business_id [ : 7 ] ) #NEWLINE# checksum = int ( business_id [ 8 ] ) #NEWLINE# sum_ = sum ( ( ( f * n ) for ( f , n ) in zip ( factors , business_id ) ) ) #NEWLINE# modulo = ( sum_ % 11 ) #NEWLINE# return ( ( ( 11 - modulo ) == checksum ) or ( ( modulo == 0 ) and ( checksum == 0 ) ) )