def is_private_address(address):
 if (not is_valid_ipv4_address(address)):
  raise ValueError(("'%s' isn't a valid IPv4 address" % address))
 if (address.startswith('10.') or address.startswith('192.168.') or address.startswith('127.')):
  return True
 if address.startswith('172.'):
  second_octet = int(address.split('.')[1])
  if ((second_octet >= 16) and (second_octet <= 31)):
   return True
 return False

def is_private_address ( address ) : if ( not is_valid_ipv4_address ( address ) ) : raise ValueError ( ( "'%s' isn't a valid IPv4 address" % address ) ) if ( address . startswith ( '10.' ) or address . startswith ( '192.168.' ) or address . startswith ( '127.' ) ) : return True if address . startswith ( '172.' ) : second_octet = int ( address . split ( '.' ) [ 1 ] ) if ( ( second_octet >= 16 ) and ( second_octet <= 31 ) ) : return True return False
checks if the ipv4 address is in a range belonging to the local network or loopback .