Serializes family and prefix in Zebra format.

def _serialize_zebra_family_prefix(prefix):
    """
    Serializes family and prefix in Zebra format.
    """
    if ip.valid_ipv4(prefix):
        family = socket.AF_INET  # fixup
        prefix_addr, prefix_num = prefix.split('/')
        return family, struct.pack(
            _ZEBRA_FAMILY_IPV4_PREFIX_FMT,
            family,
            addrconv.ipv4.text_to_bin(prefix_addr),
            int(prefix_num))
    elif ip.valid_ipv6(prefix):
        family = socket.AF_INET6  # fixup
        prefix_addr, prefix_num = prefix.split('/')
        return family, struct.pack(
            _ZEBRA_FAMILY_IPV6_PREFIX_FMT,
            family,
            addrconv.ipv6.text_to_bin(prefix_addr),
            int(prefix_num))

    raise ValueError('Invalid prefix: %s' % prefix)