code: def check_x509_hostname(x509, hostname):
      
  
      cert_structure = extract_python_dict_from_x509(x509)
      try:
          ssl.match_hostname(cert_structure, hostname)
      except ssl.CertificateError:
          return False
      return True
docs: Check whether the given :class:`OpenSSL.crypto.X509` certificate `x509`
      matches the given `hostname`.
  
      Return :data:`True` if the name matches and :data:`False` otherwise. This
      uses :func:`ssl.match_hostname` and :func:`extract_python_dict_from_x509`.