'Return a new environ dict targeting the given wsgi.version'

def get_environ(self):

    req = self.req
    env_10 = WSGIGateway_10.get_environ(self)
    env = dict([(k.decode('ISO-8859-1'), v) for (k, v) in env_10.iteritems()])
    env[u'wsgi.version'] = ('u', 0)
    env.setdefault(u'wsgi.url_encoding', u'utf-8')
    try:
        for key in [u'PATH_INFO', u'SCRIPT_NAME', u'QUERY_STRING']:
            env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding'])
    except UnicodeDecodeError:
        env[u'wsgi.url_encoding'] = u'ISO-8859-1'
        for key in [u'PATH_INFO', u'SCRIPT_NAME', u'QUERY_STRING']:
            env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding'])
    for (k, v) in sorted(env.items()):
        if (isinstance(v, str) and (k not in ('REQUEST_URI', 'wsgi.input'))):
            env[k] = v.decode('ISO-8859-1')
    return env
