#NEWLINE# def is_valid_gateway( name , ip_addr , **kwargs ) : #NEWLINE# #INDENT# 'Valid the format of gateway.' #NEWLINE# if isinstance ( name , list ) : #NEWLINE# #INDENT# return all ( [ is_valid_gateway ( name , item , ** kwargs ) for item in ip_addr ] ) #NEWLINE# #UNINDENT# if ( not is_valid_ip ( ip_addr ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# ip = netaddr . IPAddress ( ip_addr ) #NEWLINE# if ( ip . is_private ( ) or ip . is_public ( ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# logging . debug ( '%s invalid gateway %s' , name , ip_addr ) #NEWLINE# return False