parameters: (input, tree="etree", encoding=None, **serializer_opts)
return_statement: return s.render(walker(input), encoding)
docstring: Serializes the input token stream using the specified treewalker
  
      :arg input: the token stream to serialize
  
      :arg tree: the treewalker to use
  
      :arg encoding: the encoding to use
  
      :arg serializer_opts: any options to pass to the
          :py:class:`html5lib.serializer.HTMLSerializer` that gets created
  
      :returns: the tree serialized as a string
  
      Example:
  
      >>> from html5lib.html5parser import parse
      >>> from html5lib.serializer import serialize
      >>> token_stream = parse('<html><body><p>Hi!</p></body></html>')
      >>> serialize(token_stream, omit_optional_tags=False)
      '<html><head></head><body><p>Hi!</p></body></html>'
docstring_summary: Serializes the input token stream using the specified treewalker
docstring_tokens: Serializes the input token stream using the specified treewalker
function: def serialize(input, tree="etree", encoding=None, **serializer_opts):
      """Serializes the input token stream using the specified treewalker
  
      :arg input: the token stream to serialize
  
      :arg tree: the treewalker to use
  
      :arg encoding: the encoding to use
  
      :arg serializer_opts: any options to pass to the
          :py:class:`html5lib.serializer.HTMLSerializer` that gets created
  
      :returns: the tree serialized as a string
  
      Example:
  
      >>> from html5lib.html5parser import parse
      >>> from html5lib.serializer import serialize
      >>> token_stream = parse('<html><body><p>Hi!</p></body></html>')
      >>> serialize(token_stream, omit_optional_tags=False)
      '<html><head></head><body><p>Hi!</p></body></html>'
  
      """
      # XXX: Should we cache this?
      walker = treewalkers.getTreeWalker(tree)
      s = HTMLSerializer(**serializer_opts)
      return s.render(walker(input), encoding)
function_tokens: def serialize ( input , tree = "etree" , encoding = None , * * serializer_opts ) : # XXX: Should we cache this? walker = treewalkers . getTreeWalker ( tree ) s = HTMLSerializer ( * * serializer_opts ) return s . render ( walker ( input ) , encoding )