code: public ImmutableTerm convertIntoImmutableTerm(Term term) {
          if (term instanceof Function) {
              if (term instanceof Expression) {
                  Expression expression = (Expression) term;
                  return termFactory.getImmutableExpression(expression);
              } else {
                  Function functionalTerm = (Function) term;
  
                  if (functionalTerm.getFunctionSymbol() instanceof FunctionSymbol)
                      return termFactory.getImmutableFunctionalTerm(
                              (FunctionSymbol) functionalTerm.getFunctionSymbol(),
                              convertTerms(functionalTerm));
                  else
                      throw new NotAFunctionSymbolException(term + " is not using a FunctionSymbol but a "
                              + functionalTerm.getFunctionSymbol().getClass());
              }
          }
          /*
           * Other terms (constant and variable) are immutable.
           */
          return (ImmutableTerm) term;
      }
docs: In case the term is functional, creates an immutable copy of it.