def domain_match(A, B):
 A = A.lower()
 B = B.lower()
 if (A == B):
  return True
 if (not is_HDN(A)):
  return False
 i = A.rfind(B)
 if ((i == (-1)) or (i == 0)):
  return False
 if (not B.startswith('.')):
  return False
 if (not is_HDN(B[1:])):
  return False
 return True

def domain_match ( A , B ) : A = A . lower ( ) B = B . lower ( ) if ( A == B ) : return True if ( not is_HDN ( A ) ) : return False i = A . rfind ( B ) if ( ( i == ( - 1 ) ) or ( i == 0 ) ) : return False if ( not B . startswith ( '.' ) ) : return False if ( not is_HDN ( B [ 1 : ] ) ) : return False return True
return true if domain a domain-matches domain b .