'Convert headers into the format expected by WSGI servers.
Args:
media_type: Default media type to use for the Content-Type
header if the header was not set explicitly (default ``None``).'

def _wsgi_headers(self, media_type=None, py2=PY2):

    headers = self._headers
    self._set_media_type(media_type)
    if py2:
        items = headers.items()
    else:
        items = list(headers.items())
    if (self._cookies is not None):
        items += [('set-cookie', c.OutputString()) for c in self._cookies.values()]
    return items
