def ipv6(self, ipv4_compatible=False):
        ip = None
        klass = self.__class__

        if self._module.version == 6:
            if ipv4_compatible and \
                (0xffff00000000 <= self._value <= 0xffffffffffff):
                ip = klass((self._value - 0xffff00000000, self._prefixlen),
                    version=6)
            else:
                ip = klass((self._value, self._prefixlen), version=6)
        elif self._module.version == 4:
            if ipv4_compatible:
                #   IPv4-Compatible IPv6 address
                ip = klass((self._value, self._prefixlen + 96), version=6)
            else:
                #   IPv4-Mapped IPv6 address
                ip = klass((0xffff00000000 + self._value,
                            self._prefixlen + 96), version=6)

        return ip
.. note:: the IPv4-mapped IPv6 address format is now considered         deprecated. See RFC 4291 or later for details.
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/__init__.py/IPNetwork.ipv6