def netmask(mask):
 if (not isinstance(mask, string_types)):
  return False
 octets = mask.split('.')
 if (not (len(octets) == 4)):
  return False
 return (ipv4_addr(mask) and (octets == sorted(octets, reverse=True)))

def netmask ( mask ) : if ( not isinstance ( mask , string_types ) ) : return False octets = mask . split ( '.' ) if ( not ( len ( octets ) == 4 ) ) : return False return ( ipv4_addr ( mask ) and ( octets == sorted ( octets , reverse = True ) ) )
returns true if the value passed is a valid netmask .