def find_duplicative_certs(config, domains):
 def update_certs_for_domain_matches(candidate_lineage, rv):
  'Return cert as identical_names_cert if it matches,\n           or subset_names_cert if it matches as subset\n        '
  (identical_names_cert, subset_names_cert) = rv
  candidate_names = set(candidate_lineage.names())
  if (candidate_names == set(domains)):
   identical_names_cert = candidate_lineage
  elif candidate_names.issubset(set(domains)):
   if (subset_names_cert is None):
    subset_names_cert = candidate_lineage
   elif (len(candidate_names) > len(subset_names_cert.names())):
    subset_names_cert = candidate_lineage
  return (identical_names_cert, subset_names_cert)
 return _search_lineages(config, update_certs_for_domain_matches, (None, None))

def find_duplicative_certs ( config , domains ) : def update_certs_for_domain_matches ( candidate_lineage , rv ) : ( identical_names_cert , subset_names_cert ) = rv candidate_names = set ( candidate_lineage . names ( ) ) if ( candidate_names == set ( domains ) ) : identical_names_cert = candidate_lineage elif candidate_names . issubset ( set ( domains ) ) : if ( subset_names_cert is None ) : subset_names_cert = candidate_lineage elif ( len ( candidate_names ) > len ( subset_names_cert . names ( ) ) ) : subset_names_cert = candidate_lineage return ( identical_names_cert , subset_names_cert ) return _search_lineages ( config , update_certs_for_domain_matches , ( None , None ) )
find existing certs that duplicate the request .