#NEWLINE# def is_ipv4( ip_str ) : #NEWLINE# #INDENT# '\n    Validate whether given string is IPv4.\n\n    :param ip_str: String to validate.\n    :type ip_str: ``str``\n\n    :rtype: ``bool``\n    ' #NEWLINE# try : #NEWLINE# #INDENT# addr = ipaddr . IPAddress ( ip_str ) #NEWLINE# return ( addr . version == 4 ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return False