Get IP from request.

        :param request: A usual request object
        :type request: HttpRequest
        :return: ipv4 string or None

def _get_real_ip(self):
        """
        Get IP from request.

        :param request: A usual request object
        :type request: HttpRequest
        :return: ipv4 string or None
        """
        try:
            # Trying to work with most common proxy headers
            real_ip = self.request.META['HTTP_X_FORWARDED_FOR']
            return real_ip.split(',')[0]
        except KeyError:
            return self.request.META['REMOTE_ADDR']
        except Exception:
            # Unknown IP
            return None