#NEWLINE# def _parse_regexes( regexes , lines ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'ipv4' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'ipv6' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# for line in lines : #NEWLINE# #INDENT# for ( regex , groups ) in i : #NEWLINE# #INDENT# matched = False #NEWLINE# matches = re . match ( regex , line ) #NEWLINE# if matches : #NEWLINE# #INDENT# for ( i , group ) in enumerate ( groups [ 1 : ] ) : #NEWLINE# #INDENT# data [ groups [ 0 ] ] [ group ] = matches . group ( ( i + 1 ) ) #NEWLINE# #UNINDENT# matched = True #NEWLINE# break #NEWLINE# #UNINDENT# if matched : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return data