docs: def _control_nonterminal(nonterm):
          # type: (Type[Nonterminal]) -> None
          """
          Check if the nonterminal is valid.
          :param nonterm: Nonterminal to check.
          :raise NotNonterminalException: If the object doesn't inherit from Nonterminal class.
          """
          if not inspect.isclass(nonterm) or not issubclass(nonterm, Nonterminal):
              raise NotNonterminalException(nonterm)