def get_netmask(ip, subnet):
 if (ip['version'] == 4):
  return str(subnet.as_netaddr().netmask)
 return subnet.as_netaddr()._prefixlen

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