code: def profile(self, func):
          
          pr = cProfile.Profile()
          pr.runcall(func)
          st = pstats.Stats(pr)
          st.stream = None  # make it picklable
          st.strip_dirs()
  
          # Adds a new profile to the existing accumulated value
          self._accumulator.add(st)
docs: Runs and profiles the method to_profile passed in. A profile object is returned.