docs: def remove_useless_symbols(grammar, inplace=False):
          # type: (Grammar, bool) -> Grammar
          """
          Remove useless symbols from the grammar.
          Useless symbols are unreachable or nongenerating one.
          :param grammar: Grammar where to symbols remove
          :param inplace: True if transformation should be performed in place, false otherwise.
          False by default.
          :return: Grammar without useless symbols.
          """
          grammar = ContextFree.remove_nongenerating_nonterminals(grammar, inplace)
          grammar = ContextFree.remove_unreachable_symbols(grammar, True)
          return grammar