def check_ip(addr):
 try:
  addr = addr.rsplit('/', 1)
 except AttributeError:
  return False
 if salt.utils.network.is_ipv4(addr[0]):
  try:
   if (1 <= int(addr[1]) <= 32):
    return True
  except ValueError:
   return False
  except IndexError:
   return True
 if salt.utils.network.is_ipv6(addr[0]):
  try:
   if (8 <= int(addr[1]) <= 128):
    return True
  except ValueError:
   return False
  except IndexError:
   return True
 return False

def check_ip ( addr ) : try : addr = addr . rsplit ( '/' , 1 ) except AttributeError : return False if salt . utils . network . is_ipv4 ( addr [ 0 ] ) : try : if ( 1 <= int ( addr [ 1 ] ) <= 32 ) : return True except ValueError : return False except IndexError : return True if salt . utils . network . is_ipv6 ( addr [ 0 ] ) : try : if ( 8 <= int ( addr [ 1 ] ) <= 128 ) : return True except ValueError : return False except IndexError : return True return False
check if address is a valid ip .