Did I find the right examples for you? yes no

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Unpack an IPv4 address that was mapped in a compressed IPv6 address.

This converts 0000:0000:0000:0000:0000:ffff:10.10.10.10 to 10.10.10.10.
If there is nothing to sanitize, returns None.

Args:
    ip_str: A string, the expanded IPv6 address.

Returns:
    The unpacked IPv4 address, or None if there was nothing to unpack.

        def _unpack_ipv4(ip_str):
    """
    Unpack an IPv4 address that was mapped in a compressed IPv6 address.

    This converts 0000:0000:0000:0000:0000:ffff:10.10.10.10 to 10.10.10.10.
    If there is nothing to sanitize, returns None.

    Args:
        ip_str: A string, the expanded IPv6 address.

    Returns:
        The unpacked IPv4 address, or None if there was nothing to unpack.
    """
    if not ip_str.lower().startswith('0000:0000:0000:0000:0000:ffff:'):
        return None

    return ip_str.rsplit(':', 1)[1]
        


src/s/t/stopforumspam-1.4.1/stopforumspam/middleware.py   stopforumspam(Download)
    def check_request_ip(self, request):
 
        remote_ip = ipv6._unpack_ipv4(request.META['REMOTE_ADDR'])
 
        cache_entries = models.Cache.objects.filter(ip=remote_ip)