code: def exponential_terms(order, variables, data):
      
      variables_exp = OrderedDict()
      data_exp = OrderedDict()
      if 1 in order:
          data_exp[1] = data[variables]
          variables_exp[1] = variables
          order = set(order) - set([1])
      for o in order:
          variables_exp[o] = ['{}_power{}'.format(v, o) for v in variables]
          data_exp[o] = data[variables]**o
      variables_exp = reduce((lambda x, y: x + y), variables_exp.values())
      data_exp = pd.DataFrame(columns=variables_exp,
                              data=np.concatenate([*data_exp.values()], axis=1))
      return (variables_exp, data_exp)
docs: Compute exponential expansions.
  
      Parameters
      ----------
      order: range or list(int)
          A list of exponential terms to include. For instance, [1, 2]
          indicates that the first and second exponential terms should be added.
          To retain the original terms, 1 *must* be included in the list.
      variables: list(str)
          List of variables for which exponential terms should be computed.
      data: pandas DataFrame object
          Table of values of all observations of all variables.
  
      Returns
      -------
      variables_exp: list
          A list of variables to include in the final data frame after adding
          the specified exponential terms.
      data_exp: pandas DataFrame object
          Table of values of all observations of all variables, including any
          specified exponential terms.