code: def run(self, instance):
          
  
          last = instance
  
          for item in self.stack:
              if isinstance(item, str):
                  last = getattr(last, item)
              else:
                  last = last(*item[0], **item[1])
  
          self.stack = []
          return last
docs: Run the recorded chain of methods on `instance`.
  
          Args:
              instance: an object.