For command line experimentation. Sample output:
    
    $ python l2cs.py 'foo:bar AND baz:bork'
    Lucene input: foo:bar AND baz:bork
    Parsed representation: And([Term(u'foo', u'bar'), Term(u'baz', u'bork')])
    Lucene form: (foo:bar AND baz:bork)
    Cloudsearch form: (and (field foo 'bar') (field baz 'bork'))

def main(args):
    '''For command line experimentation. Sample output:
    
    $ python l2cs.py 'foo:bar AND baz:bork'
    Lucene input: foo:bar AND baz:bork
    Parsed representation: And([Term(u'foo', u'bar'), Term(u'baz', u'bork')])
    Lucene form: (foo:bar AND baz:bork)
    Cloudsearch form: (and (field foo 'bar') (field baz 'bork'))
    
    '''
    args = [unicode(u, 'utf-8') for u in args[1:]]
    schema = __sample_schema() if "--schema" in args else None
    if schema:
        args.pop(args.index("--schema"))
    query = u' '.join(args)
    print "Lucene input:", query
    parser = __sample_parser(schema=schema)
    parsed = parser.parse(query)
    print "Parsed representation:", repr(parsed)
    print "Lucene form:", unicode(parsed)
    cloudsearch_query = ''.join(walk_clause(parsed))
    print "Cloudsearch form:", cloudsearch_query