def get_netmask(ip, subnet):
    'Returns the netmask appropriate for injection into a guest.'
    if (ip['version'] == 4):
        return str(subnet.as_netaddr().netmask)
    return subnet.as_netaddr()._prefixlen
Returns the netmask appropriate for injection into a guest.
def get_netmask(ip, subnet):
    
    if (ip['version'] == 4):
        return str(subnet.as_netaddr().netmask)
    return subnet.as_netaddr()._prefixlen