def guess_currency_from_address(address):
if is_py2:<EOL><INDENT>fixer = lambda x: int(x.encode('<STR_LIT>'), <NUM_LIT:16>)<EOL><DEDENT>else:<EOL><INDENT>fixer = lambda x: x <EOL><DEDENT>first_byte = fixer(b58decode_check(address)[<NUM_LIT:0>])<EOL>double_first_byte = fixer(b58decode_check(address)[:<NUM_LIT:2>])<EOL>hits = []<EOL>for currency, data in crypto_data.items():<EOL><INDENT>if hasattr(data, '<STR_LIT>'): <EOL><INDENT>version = data.get('<STR_LIT>', None)<EOL>if version is not None and version in [double_first_byte, first_byte]:<EOL><INDENT>hits.append([currency, data['<STR_LIT:name>']])<EOL><DEDENT><DEDENT><DEDENT>if hits:<EOL><INDENT>return hits<EOL><DEDENT>raise ValueError("<STR_LIT>" % first_byte)<EOL>
Given a crypto address, find which currency it likely belongs to.
Raises an exception if it can't find a match. Raises exception if address
is invalid.