code: def emit(
      events,
      stream=None,
      Dumper=Dumper,
      canonical=None,
      indent=None,
      width=None,
      allow_unicode=None,
      line_break=None,
  ):
      """
      Emit YAML parsing events into a stream.
      If stream is None, return the produced string instead.
      """
      getvalue = None
      if stream is None:
          stream = io.StringIO()
          getvalue = stream.getvalue
      dumper = Dumper(
          stream,
          canonical=canonical,
          indent=indent,
          width=width,
          allow_unicode=allow_unicode,
          line_break=line_break,
      )
      try:
          for event in events:
              dumper.emit(event)
      finally:
          dumper.dispose()
      if getvalue:
          return getvalue()
  
imports: from .error import *
  from .tokens import *
  from .events import *
  from .nodes import *
  from .loader import *
  from .dumper import *
  import io
label_desc: Use image node_id 15 for calling a global function with example usage: emit(events, stream, Dumper, canonical, indent, width, allow_unicode, line_break) and returns: getvalue