code: def get_single_node(self):
      # Drop the STREAM-START event.
      self.get_event()
  
      # Compose a document if the stream is not empty.
      document = None
      if not self.check_event(StreamEndEvent):
          document = self.compose_document()
  
      # Ensure that the stream contains no more documents.
      if not self.check_event(StreamEndEvent):
          event = self.get_event()
          raise ComposerError(
              "expected a single document in the stream",
              document.start_mark,
              "but found another document",
              event.start_mark,
          )
  
      # Drop the STREAM-END event.
      self.get_event()
  
      return document
  
file_path: keepsake/python/keepsake/_vendor/yaml/composer.py
imports: from .error import MarkedYAMLError
  from .events import *
  from .nodes import *
label_desc: Use image node_id 4 for calling the Composer obj's underlying member method code with example usage: obj.get_single_node() and returns: document