#NEWLINE# def parse_packages( regex , output , lower = True ) : #NEWLINE# #INDENT# packages = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for line in output : #NEWLINE# #INDENT# matches = re . match ( regex , line ) #NEWLINE# if matches : #NEWLINE# #INDENT# name = matches . group ( 1 ) #NEWLINE# if lower : #NEWLINE# #INDENT# name = name . lower ( ) #NEWLINE# #UNINDENT# packages [ name ] = matches . group ( 2 ) #NEWLINE# #UNINDENT# #UNINDENT# return packages