#NEWLINE# def normalize_query( self , query_string , findterms = re . compile ( '"([^"]+)"|(\\S+)' ) . findall , normspace = re . compile ( '\\s{2,}' ) . sub ) : #NEWLINE# #INDENT# '\n        Splits the query string in invidual keywords, getting rid of unecessary spaces\n        and grouping quoted words together.\n\n        Example:\n        > self.normalize_query(\'  some random  words "with   quotes  " and   spaces\')\n        [\'some\', \'random\', \'words\', \'with quotes\', \'and\', \'spaces\']\n\n        ' #NEWLINE# return [ normspace ( ' ' , ( t [ 0 ] or t [ 1 ] ) . strip ( ) ) for t in findterms ( query_string ) ]