def get_user_ip(request):
    """
    Utility function for getting user's IP from request address.

    This either returns the IP address from the ``request.REMOTE_ADDR``
    or ``request.META'HTTP_X_REAL_IP']`` when request might of
    been reverse proxied.
    """
    return (
        request.META.get('HTTP_X_REAL_IP')
        or request.META['REMOTE_ADDR']
    )