code: def run(self, duration, obs):
          
          from ecell4_base.core import TimeoutObserver
  
          timeout = TimeoutObserver(self.__timeout)
          if isinstance(obs, collections.Iterable):
              obs = tuple(obs) + (timeout, )
          else:
              obs = (obs, timeout)
          p = ProgressBar(**self.__kwargs)
          p.animate(0.0)
          tstart = self.__sim.t()
          upto = tstart + duration
          while self.__sim.t() < upto:
              self.__sim.run(upto - self.__sim.t(), obs)
              p.animate((self.__sim.t() - tstart) / duration, timeout.accumulation())
          if self.__flush:
              p.flush()
          else:
              print()
docs: Run the simulation.
  
          Parameters
          ----------
          duration : Real
              a duration for running a simulation.
                  A simulation is expected to be stopped at t() + duration.
          observers : list of Obeservers, optional
              observers