code: def serialize(self, node):
      if self.closed is None:
          raise SerializerError("serializer is not opened")
      elif self.closed:
          raise SerializerError("serializer is closed")
      self.emit(
          DocumentStartEvent(
              explicit=self.use_explicit_start,
              version=self.use_version,
              tags=self.use_tags,
          )
      )
      self.anchor_node(node)
      self.serialize_node(node, None, None)
      self.emit(DocumentEndEvent(explicit=self.use_explicit_end))
      self.serialized_nodes = {}
      self.anchors = {}
      self.last_anchor_id = 0
  
file_path: keepsake/python/keepsake/_vendor/yaml/serializer.py
imports: from .error import YAMLError
  from .events import *
  from .nodes import *
label_desc: Use image node_id 4 for calling the Serializer obj's underlying member method code with example usage: obj.serialize(node) without return types