code: def _SerializeRequest(self, request):
          
          # Construct status line
          parsed = urllib_parse.urlsplit(request.url)
          request_line = urllib_parse.urlunsplit(
              ('', '', parsed.path, parsed.query, ''))
          if not isinstance(request_line, six.text_type):
              request_line = request_line.decode('utf-8')
          status_line = u' '.join((
              request.http_method,
              request_line,
              u'HTTP/1.1\n'
          ))
          major, minor = request.headers.get(
              'content-type', 'application/json').split('/')
          msg = mime_nonmultipart.MIMENonMultipart(major, minor)
  
          # MIMENonMultipart adds its own Content-Type header.
          # Keep all of the other headers in `request.headers`.
          for key, value in request.headers.items():
              if key == 'content-type':
                  continue
              msg[key] = value
  
          msg['Host'] = parsed.netloc
          msg.set_unixfrom(None)
  
          if request.body is not None:
              msg.set_payload(request.body)
  
          # Serialize the mime message.
          str_io = six.StringIO()
          # maxheaderlen=0 means don't line wrap headers.
          gen = generator.Generator(str_io, maxheaderlen=0)
          gen.flatten(msg, unixfrom=False)
          body = str_io.getvalue()
  
          return status_line + body
docs: Convert a http_wrapper.Request object into a string.
  
          Args:
            request: A http_wrapper.Request to serialize.
  
          Returns:
            The request as a string in application/http format.