'Returns the IPv6 mapped address of an IPv4 address, or the corresponding
IPv4 address if the IPv6 address is in the appropriate range.
Raises a ValueError if the IPv6 address is not translatable. See RFC 4291.
>>> IP(\'192.168.1.1\').v46map()
IP(\'::ffff:192.168.1.1\')
>>> IP(\'::ffff:192.168.1.1\').v46map()
IP(\'192.168.1.1\')'

def v46map(self):

    if (self._ipversion == 4):
        return IP((str((IPV6_MAP_MASK + self.ip)) + ('/%s' % (self._prefixlen + 96))))
    elif ((self.ip & IPV6_TEST_MAP) == IPV6_MAP_MASK):
        return IP((str((self.ip - IPV6_MAP_MASK)) + ('/%s' % (self._prefixlen - 96))))
    raise ValueError(('%s    cannot    be    converted    to    an    IPv4    address.' % repr(self)))
