def ipv6_mask_to_long(mask):
    """Convert an IPv6 prefixlen to long

    >>> ipv6_mask_to_long(64)
    340282366920938463444927863358058659840L
    >>> ipv6_mask_to_long(128)
    340282366920938463463374607431768211455L
    """
    mask_binary = ("1" * mask) + ("0" * (128-mask))
    return int(mask_binary, 2)