docs: def from_string(cls, string, pset):
          """Try to convert a string expression into a PrimitiveTree given a
          PrimitiveSet *pset*. The primitive set needs to contain every primitive
          present in the expression.
  
          :param string: String representation of a Python expression.
          :param pset: Primitive set from which primitives are selected.
          :returns: PrimitiveTree populated with the deserialized primitives.
          """
          tokens = re.split("[ \t\n\r\f\v(),]", string)
          expr = []
  
          def get_parts(token_string):
              parts = tokens[i].split('_')
              return parts[1], parts[2], parts[3]
          i = 0
          while i < len(tokens):
              if tokens[i] == '':
                  i += 1
                  continue
              if tokens[i] in pset.mapping:
                  primitive = pset.mapping[tokens[i]]
                  expr.append(primitive)
              elif RangeOperationTerminal.NAME in tokens[i]:
                  operation, begin_range_name, end_range_name = get_parts(tokens[i])
                  range_operation_terminal = RangeOperationTerminal()
                  range_operation_terminal.initialize_parameters(pset.variable_type_indices, pset.variable_names,
                                                                 operation, begin_range_name, end_range_name)
                  expr.append(range_operation_terminal)
              elif MomentFindingTerminal.NAME in tokens[i]:
                  operation, begin_range_name, end_range_name = get_parts(tokens[i])
                  moment_operation_terminal = MomentFindingTerminal()
                  moment_operation_terminal.initialize_parameters(pset.variable_type_indices, pset.variable_names,
                                                                  operation, begin_range_name, end_range_name)
                  expr.append(moment_operation_terminal)
              else:
                  try:
                      token = eval(tokens[i])
                  except NameError:
                      raise TypeError("Unable to evaluate terminal: {}.".format(tokens[i]))
                  expr.append(gp.Terminal(token, False, gp.__type__))
              i += 1
          return cls(expr)