def get_subj_alt_name(peer_cert):
 cert = _Certificate(openssl_backend, peer_cert._x509)
 try:
  ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value
 except x509.ExtensionNotFound:
  return []
 except (x509.DuplicateExtension, x509.UnsupportedExtension, x509.UnsupportedGeneralNameType, UnicodeError) as e:
  log.warning('A problem was encountered with the certificate that prevented urllib3 from finding the SubjectAlternativeName field. This can affect certificate validation. The error was %s', e)
  return []
 names = [('DNS', _dnsname_to_stdlib(name)) for name in ext.get_values_for_type(x509.DNSName)]
 names.extend((('IP Address', str(name)) for name in ext.get_values_for_type(x509.IPAddress)))
 return names

def get_subj_alt_name ( peer_cert ) : cert = _Certificate ( openssl_backend , peer_cert . _x509 ) try : ext = cert . extensions . get_extension_for_class ( x509 . SubjectAlternativeName ) . value except x509 . ExtensionNotFound : return [ ] except ( x509 . DuplicateExtension , x509 . UnsupportedExtension , x509 . UnsupportedGeneralNameType , UnicodeError ) as e : log . warning ( 'A problem was encountered with the certificate that prevented urllib3 from finding the SubjectAlternativeName field. This can affect certificate validation. The error was %s' , e ) return [ ] names = [ ( 'DNS' , _dnsname_to_stdlib ( name ) ) for name in ext . get_values_for_type ( x509 . DNSName ) ] names . extend ( ( ( 'IP Address' , str ( name ) ) for name in ext . get_values_for_type ( x509 . IPAddress ) ) ) return names
given an pyopenssl certificate .