#NEWLINE# def get_rules( self , description = None ) : #NEWLINE# #INDENT# '\n        Returns a list of extraction rules that match a given description.\n\n        @description - The description to match against.\n\n        Returns a list of extraction rules that match the given description.\n        If no description is provided, a list of all rules are returned.\n        ' #NEWLINE# if description : #NEWLINE# #INDENT# rules = [ ] #NEWLINE# description = description . lower ( ) #NEWLINE# for i in range ( 0 , len ( self . extract_rules ) ) : #NEWLINE# #INDENT# if self . extract_rules [ i ] [ 'regex' ] . search ( description ) : #NEWLINE# #INDENT# rules . append ( self . extract_rules [ i ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# rules = self . extract_rules #NEWLINE# #UNINDENT# return rules