code: def __init__(
      self,
      stream,
      canonical=None,
      indent=None,
      width=None,
      allow_unicode=None,
      line_break=None,
  ):
      # The stream should have the methods `write` and possibly `flush`.
      self.stream = stream
  
      # Encoding can be overridden by STREAM-START.
      self.encoding = None
  
      # Emitter is a state machine with a stack of states to handle nested
      # structures.
      self.states = []
      self.state = self.expect_stream_start
  
      # Current event and the event queue.
      self.events = []
      self.event = None
  
      # The current indentation level and the stack of previous indents.
      self.indents = []
      self.indent = None
  
      # Flow level.
      self.flow_level = 0
  
      # Contexts.
      self.root_context = False
      self.sequence_context = False
      self.mapping_context = False
      self.simple_key_context = False
  
      # Characteristics of the last emitted character:
      #  - current position.
      #  - is it a whitespace?
      #  - is it an indention character
      #    (indentation space, '-', '?', or ':')?
      self.line = 0
      self.column = 0
      self.whitespace = True
      self.indention = True
  
      # Whether the document requires an explicit document indicator
      self.open_ended = False
  
      # Formatting details.
      self.canonical = canonical
      self.allow_unicode = allow_unicode
      self.best_indent = 2
      if indent and 1 < indent < 10:
          self.best_indent = indent
      self.best_width = 80
      if width and width > self.best_indent * 2:
          self.best_width = width
      self.best_line_break = "\n"
      if line_break in ["\r", "\n", "\r\n"]:
          self.best_line_break = line_break
  
      # Tag prefixes.
      self.tag_prefixes = None
  
      # Prepared anchor and tag.
      self.prepared_anchor = None
      self.prepared_tag = None
  
      # Scalar analysis and style.
      self.analysis = None
      self.style = None
  
imports: from .error import YAMLError
  from .events import *
label_desc: Use image node_id 1 to create a new Emitter object  with example: obj = Emitter(stream, canonical, indent, width, allow_unicode, line_break)