docs: def update_history(self, it, j=0, M=None, **kwargs):
          """Add the current state for all kwargs to the history
          """
          # Create a new entry in the history for new variables (if they don't exist)
          if not np.any([k in self.history[j] for k in kwargs]):
              for k in kwargs:
                  if M is None or M == 0:
                      self.history[j][k] = [[]]
                  else:
                      self.history[j][k] = [[] for m in range(M)]
          """
          # Check that the variables have been updated once per iteration
          elif np.any([[len(h)!=it+self.offset for h in self.history[j][k]] for k in kwargs.keys()]):
              for k in kwargs.keys():
                  for n,h in enumerate(self.history[j][k]):
                      if len(h) != it+self.offset:
                          err_str = "At iteration {0}, {1}[{2}] already has {3} entries"
                          raise Exception(err_str.format(it, k, n, len(h)-self.offset))
          """
          # Add the variables to the history
          for k,v in kwargs.items():
              if M is None or M == 0:
                  self._store_variable(j, k, 0, v)
              else:
                  for m in range(M):
                      self._store_variable(j, k, m, v[m])