def subnetToDict(prefix, subnet):
    """
    Generate a dict from a subnet using the specified prefix.
    """
    return {
        "%s_subnet" % prefix: subnet.network,
        "%s_subnet_cidr" % prefix: subnet.cidr,
        "%s_subnet_mask" % prefix: subnet.netmask,
        "%s_subnet_gateway" % prefix: subnet.gateway
    }