def queryize(terms, exclude_screen_name=None):
ors = '<STR_LIT>'.join('<STR_LIT>'.format(x) for x in terms if not x.startswith('<STR_LIT:->'))<EOL>nots = '<STR_LIT:U+0020>'.join('<STR_LIT>'.format(x[<NUM_LIT:1>:]) for x in terms if x.startswith('<STR_LIT:->'))<EOL>sn = "<STR_LIT>".format(exclude_screen_name) if exclude_screen_name else '<STR_LIT>'<EOL>return '<STR_LIT:U+0020>'.join((ors, nots, sn))<EOL>
Create query from list of terms, using OR
but intelligently excluding terms beginning with '-' (Twitter's NOT operator).
Optionally add -from:exclude_screen_name.

>>> helpers.queryize(['apple', 'orange', '-peach'])
u'apple OR orange -peach'

Args:
    terms (list): Search terms.
    exclude_screen_name (str): A single screen name to exclude from the search.

Returns:
    A string ready to be passed to tweepy.API.search