def is_nt(token):
  """Return whether the token is NT or not."""
  if not token:
    return False
  if isinstance(token, NT):
    return True
  elif isinstance(token, str) and token.startswith(NON_TERMINAL_PREFIX):
    return True
  return False
Return whether the token is NT or not.
language/compgen/csl/qcfg/qcfg_rule.py