code: def sample(self, iter, length=None, verbose=0):
          
          self._cur_trace_index = 0
          self.max_trace_length = iter
          self._iter = iter
          self.verbose = verbose or 0
          self.seed()
  
          # Assign Trace instances to tallyable objects.
          self.db.connect_model(self)
  
          # Initialize database -> initialize traces.
          if length is None:
              length = iter
          self.db._initialize(self._funs_to_tally, length)
  
          # Put traces on objects
          for v in self._variables_to_tally:
              v.trace = self.db._traces[v.__name__]
  
          # Loop
          self._current_iter = 0
          self._loop()
          self._finalize()
docs: Draws iter samples from the posterior.