def load_public_key(source):
if isinstance(source, keys.PublicKeyInfo):<EOL><INDENT>public_key = source<EOL><DEDENT>elif isinstance(source, byte_cls):<EOL><INDENT>public_key = parse_public(source)<EOL><DEDENT>elif isinstance(source, str_cls):<EOL><INDENT>with open(source, '<STR_LIT:rb>') as f:<EOL><INDENT>public_key = parse_public(f.read())<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(public_key)<EOL>))<EOL><DEDENT>return _load_key(public_key, PublicKey)<EOL>
Loads a public key into a PublicKey object

:param source:
    A byte string of file contents, a unicode string filename or an
    asn1crypto.keys.PublicKeyInfo object

:raises:
    ValueError - when any of the parameters contain an invalid value
    TypeError - when any of the parameters are of the wrong type
    oscrypto.errors.AsymmetricKeyError - when the public key is incompatible with the OS crypto library
    OSError - when an error is returned by the OS crypto library

:return:
    A PublicKey object