code: def GetValidHostsForCert(cert):
    
    if 'subjectAltName' in cert:
      return [x[1] for x in cert['subjectAltName'] if x[0].lower() == 'dns']
    else:
      return [x[0][1] for x in cert['subject']
              if x[0][0].lower() == 'commonname']
docs: Returns a list of valid host globs for an SSL certificate.
  
    Args:
      cert: A dictionary representing an SSL certificate.
    Returns:
      list: A list of valid host globs.