'Verify that the netmask is valid.
Args:
netmask: A string, either a prefix or dotted decimal
netmask.
Returns:
A boolean, True if the prefix represents a valid IPv4
netmask.'

def _is_valid_netmask(self, netmask):

    if (len(netmask.split('.')) == 4):
        return self._is_valid_ip(netmask)
    try:
        netmask = int(netmask)
    except ValueError:
        return False
    return (0 <= netmask <= 32)
