'WSGI conform list of (header, value) tuples.'

@property
def headerlist(self):

    out = []
    headers = list(self._headers.items())
    if ('Content-Type' not in self._headers):
        headers.append(('Content-Type', [self.default_content_type]))
    if (self._status_code in self.bad_headers):
        bad_headers = self.bad_headers[self._status_code]
        headers = [h for h in headers if (h[0] not in bad_headers)]
    out += [(name, val) for (name, vals) in headers for val in vals]
    if self._cookies:
        for c in self._cookies.values():
            out.append(('Set-Cookie', c.OutputString()))
    if py3k:
        return [(k, v.encode('utf8').decode('latin1')) for (k, v) in out]
    else:
        return [(k, (v.encode('utf8') if isinstance(v, unicode) else v)) for (k, v) in out]
