def is_ipv4_addr(ip):
 parts = ip.split('.')
 try:
  return ((len(parts) == 4) and all(((0 <= int(part) < 256) for part in parts)))
 except:
  return False

def is_ipv4_addr ( ip ) : parts = ip . split ( '.' ) try : return ( ( len ( parts ) == 4 ) and all ( ( ( 0 <= int ( part ) < 256 ) for part in parts ) ) ) except : return False
simple way to check if ipv4 address .