'This is automatically called right before the response is started
and returns headers modified for the given environment.  It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the location header (if present) is joined with the root
URL of the environment.  Also the content length is automatically set
to zero here for certain status codes.
.. versionchanged:: 0.6
Previously that function was called `fix_headers` and modified
the response object in place.  Also since 0.6, IRIs in location
and content-location headers are handled properly.
Also starting with 0.6, Werkzeug will attempt to set the content
length if it is able to figure it out on its own.  This is the
case if all the strings in the response iterable are already
encoded and the iterable is buffered.
:param environ: the WSGI environment of the request.
:return: returns a new :class:`~werkzeug.datastructures.Headers`
object.'

def get_wsgi_headers(self, environ):

    headers = Headers(self.headers)
    location = None
    content_location = None
    content_length = None
    status = self.status_code
    for (key, value) in headers:
        ikey = key.lower()
        if (ikey == u'location'):
            location = value
        elif (ikey == u'content-location'):
            content_location = value
        elif (ikey == u'content-length'):
            content_length = value
    if (location is not None):
        old_location = location
        if isinstance(location, text_type):
            location = iri_to_uri(location, safe_conversion=True)
        if self.autocorrect_location_header:
            current_url = get_current_url(environ, root_only=True)
            if isinstance(current_url, text_type):
                current_url = iri_to_uri(current_url)
            location = url_join(current_url, location)
        if (location != old_location):
            headers['Location'] = location
    if ((content_location is not None) and isinstance(content_location, text_type)):
        headers['Content-Location'] = iri_to_uri(content_location)
    if ((100 <= status < 200) or (status == 204)):
        headers['Content-Length'] = content_length = u'0'
    elif (status == 304):
        remove_entity_headers(headers)
    if (self.automatically_set_content_length and self.is_sequence and (content_length is None) and (status != 304)):
        try:
            content_length = sum((len(to_bytes(x, 'ascii')) for x in self.response))
        except UnicodeError:
            pass
        else:
            headers['Content-Length'] = str(content_length)
    return headers
