'Handle netmask_v6 possibilities from the database.
Historically, this was stored as just an integral CIDR prefix,
but in the future it should be stored as an actual netmask.
Be tolerant of either here.'

@staticmethod
def _convert_legacy_ipv6_netmask(netmask):

    try:
        prefix = int(netmask)
        return netaddr.IPNetwork(('1::/%i' % prefix)).netmask
    except ValueError:
        pass
    try:
        return netaddr.IPNetwork(netmask).netmask
    except netaddr.AddrFormatError:
        raise ValueError((_('IPv6    netmask    "%s"    must    be    a    netmask    or    integral    prefix') % netmask))
