def get_client_ip(request):
    """get a client IP like:

        "remote_addr=255.255.255.255 forwarded_for=10.0.0.0 42.0.32.12 ..."

    ... up to 250 characters.
    """

    xff = request.META.get('HTTP_X_FORWARDED_FOR')
    ra = request.META.get('REMOTE_ADDR')

    if xff and ra:
        ret = "remote_addr=%s forwarded_for=%s" % (ra, xff)

    elif xff:
        ret = "forwarded_for=%s" % xff

    elif ra:
        ret = "remote_addr=%s" % ra

    else:
        ret = "unknown"

    return ret[:250]