code: def search_terms(q):
      '''Takes a search string and parses it into a list of keywords and
      phrases.'''
      tokens = parse_search_terms(q)
      # iterate through all the tokens and make a list of token values
      # (which are the actual words and phrases)
      values = []
      for t in tokens:
          # word/phrase
          if t[0] is None:
              values.append(t[1])
          # incomplete field
          elif t[1] is None:
              values.append('%s:' % t[0])
          # anything else must be a field, value pair
          # - if value includes whitespace, wrap in quotes
          elif re.search('\s', t[1]):
              values.append('%s:"%s"' % t)
          # otherwise, leave unquoted
          else:
              values.append('%s:%s' % t)
      return valuef search_terms(q):
      '''Takes a search string and parses it into a list of keywords and
      phrases.'''
      tokens = parse_search_terms(q)
      # iterate through all the tokens and make a list of token values
      # (which are the actual words and phrases)
      values = []
      for t in tokens:
          # word/phrase
          if t[0] is None:
              values.append(t[1])
          # incomplete field
          elif t[1] is None:
              values.append('%s:' % t[0])
          # anything else must be a field, value pair
          # - if value includes whitespace, wrap in quotes
          elif re.search('\s', t[1]):
              values.append('%s:"%s"' % t)
          # otherwise, leave unquoted
          else:
              values.append('%s:%s' % t)
      return values
docs: Takes a search string and parses it into a list of keywords and
      phrases.