def is_degenerate(identity_set, gate_identity):
 for an_id in identity_set:
  if (gate_identity in an_id.equivalent_ids):
   return True
 return False

def is_degenerate ( identity_set , gate_identity ) : for an_id in identity_set : if ( gate_identity in an_id . equivalent_ids ) : return True return False
checks if a gate identity is a permutation of another identity .