code: def cleanup(self):
      
      # Move any existing errors to global errors
      self.global_errors.extend(self.errors)
      self.errors = []
  
      # Make the previous module's output available to the next module
      self.input = self.output
      self.output = []
docs: Basic cleanup after modules.
  
      The state's output becomes the input for the next stage. Any errors are
      moved to the global_errors attribute so that they can be reported at a
      later stage.