def get_subj_alt_name(peer_cert):
<EOL>if hasattr(peer_cert, "<STR_LIT>"):<EOL><INDENT>cert = peer_cert.to_cryptography()<EOL><DEDENT>else:<EOL><INDENT>cert = _Certificate(openssl_backend, peer_cert._x509)<EOL><DEDENT>try:<EOL><INDENT>ext = cert.extensions.get_extension_for_class(<EOL>x509.SubjectAlternativeName<EOL>).value<EOL><DEDENT>except x509.ExtensionNotFound:<EOL><INDENT>return []<EOL><DEDENT>except (x509.DuplicateExtension, UnsupportedExtension,<EOL>x509.UnsupportedGeneralNameType, UnicodeError) as e:<EOL><INDENT>log.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>e,<EOL>)<EOL>return []<EOL><DEDENT>names = [<EOL>('<STR_LIT>', name) for name in map(_dnsname_to_stdlib, ext.get_values_for_type(x509.DNSName))<EOL>if name is not None<EOL>]<EOL>names.extend(<EOL>('<STR_LIT>', str(name))<EOL>for name in ext.get_values_for_type(x509.IPAddress)<EOL>)<EOL>return names<EOL>
Given an PyOpenSSL certificate, provides all the subject alternative names.