def _maybe_make_rule(source, target):
  """Canoncalize NT indexes and return QCFGRule."""
  source_nts = _get_non_terminals(source)
  target_nts = _get_non_terminals(target)
  if source_nts != target_nts:
    return None
  arity = len(source_nts)
  source, target = rule_utils.canonicalize_nts(source, target, arity)
  return qcfg_rule.QCFGRule(tuple(source), tuple(target), arity)
Canoncalize NT indexes and return QCFGRule.
language/compgen/csl/induction/unification_utils.py