code: def reset(self, document, parent, level):
          
          self.language = languages.get_language(
              document.settings.language_code)
          # setup memo
          self.memo.document = document
          self.memo.reporter = document.reporter
          self.memo.language = self.language
          self.memo.section_level = level
          # setup inliner
          if self.memo.inliner is None:
              self.memo.inliner = Inliner()
              self.memo.inliner.init_customizations(document.settings)
          inliner = self.memo.inliner
          inliner.reporter = document.reporter
          inliner.document = document
          inliner.language = self.language
          inliner.parent = parent
          # setup self
          self.document = document
          self.reporter = self.memo.reporter
          self.node = parent
          self.state.runtime_init()
          self.input_lines = document['source']
docs: Reset the state of state machine.
  
          After reset, self and self.state can be used to
          passed to docutils.parsers.rst.Directive.run
  
          Parameters
          ----------
          document: docutils document
              Current document of the node.
          parent: parent node
              Parent node that will be used to interpret role and directives.
          level: int
              Current section level.