def getClientIP(self):
        """
        Return the IPv4 address of the client which made this request, if there
        is one, otherwise L{None}.
        """
        if isinstance(self.client, (IPv4Address, IPv6Address)):
            return self.client.host
        return None

        Return the IPv4 address of the client which made this request, if there
        is one, otherwise L{None}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/requesthelper.py