parameters: (self, content, content_type, code=200, encoding=None)
docstring: Sends HTTP response.
  
      All text responses are assumed to be utf-8 unless specified otherwise.
  
      Args:
        content: The content to respond with, which is converted to bytes.
        content_type: The mime type of the content.
        code: The numeric HTTP status code to use.
        encoding: The encoding if any (not sanity checked.)
docstring_summary: Sends HTTP response.
docstring_tokens: Sends HTTP response .
function: def _respond(self, content, content_type, code=200, encoding=None):
      """Sends HTTP response.
  
      All text responses are assumed to be utf-8 unless specified otherwise.
  
      Args:
        content: The content to respond with, which is converted to bytes.
        content_type: The mime type of the content.
        code: The numeric HTTP status code to use.
        encoding: The encoding if any (not sanity checked.)
      """
      content = compat.as_bytes(content)
      self.send_response(code)
      if content_type.startswith(('text/', 'application/json')):
        if 'charset=' not in content_type:
          content_type += '; charset=utf-8'
      self.send_header('Content-Type', content_type)
      self.send_header('Content-Length', len(content))
      if encoding:
        self.send_header('Content-Encoding', encoding)
      self.end_headers()
      self.wfile.write(content)
function_tokens: def _respond ( self , content , content_type , code = 200 , encoding = None ) : content = compat . as_bytes ( content ) self . send_response ( code ) if content_type . startswith ( ( 'text/' , 'application/json' ) ) : if 'charset=' not in content_type : content_type += '; charset=utf-8' self . send_header ( 'Content-Type' , content_type ) self . send_header ( 'Content-Length' , len ( content ) ) if encoding : self . send_header ( 'Content-Encoding' , encoding ) self . end_headers ( ) self . wfile . write ( content )