'Validate the dotted decimal notation IP/netmask string.
Args:
ip_str: A string, the IP ip_str.
Returns:
A boolean, True if the string is a valid dotted decimal IP
string.'

def _is_valid_ip(self, ip_str):

    octets = ip_str.split('.')
    if (len(octets) == 1):
        try:
            return ((int(ip_str) >= 0) and (int(ip_str) <= self._ALL_ONES))
        except ValueError:
            return False
    if (len(octets) != 4):
        return False
    for octet in octets:
        try:
            if (not (0 <= int(octet) <= 255)):
                return False
        except ValueError:
            return False
    return True
