code: def last_iteration(self, parameter=None):
          
          if parameter is None:
              try:
                  parameter = list(self[self.samples_group].keys())[0]
              except (IndexError, KeyError):
                  # nothing has been written yet, just return 0
                  return 0
          try:
              lastiter = self[self.samples_group][parameter].shape[-1]
          except KeyError:
              # no samples have been written, just return 0
              lastiter = 0
          # account for thinning
          return lastiter * self.thinned_by
docs: Returns the iteration of the last sample of the given parameter.
  
          If parameter is ``None``, will just use the first parameter in the
          samples group.