code: def get_formula(self, period = None):
          
  
          if not self.formulas:
              return None
  
          if period is None:
              return self.formulas.peekitem(index = 0)[1]  # peekitem gets the 1st key-value tuple (the oldest start_date and formula). Return the formula.
  
          if isinstance(period, periods.Period):
              instant = period.start
          else:
              try:
                  instant = periods.period(period).start
              except ValueError:
                  instant = periods.instant(period)
  
          if self.end and instant.date > self.end:
              return None
  
          instant = str(instant)
          for start_date in reversed(self.formulas):
              if start_date <= instant:
                  return self.formulas[start_date]
  
          return None
docs: Returns the formula used to compute the variable at the given period.
  
          If no period is given and the variable has several formula, return the oldest formula.
  
          :returns: Formula used to compute the variable
          :rtype: function