def get_client(env):
    eget = env.get
    g = regex_client.search(eget('http_x_forwarded_for', ''))
    client = (g.group() or '').split(',')[0] if g else None
    if client in (None, '', 'unknown'):
        g = regex_client.search(eget('remote_addr', ''))
        if g:
            client = g.group()
        elif env.http_host.startswith('['):  # IPv6
            client = '::1'
        else:
            client = '127.0.0.1'  # IPv4
    if not is_valid_ip_address(client):
        raise HTTP(400, "Bad Request (request.client=%s)" % client)
    return client
guess the client address from the environment variables
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/main.py/get_client