def construct_listener(outfile=None):
if outfile is not None:<EOL><INDENT>if os.path.exists(outfile):<EOL><INDENT>raise IOError("<STR_LIT>" % outfile)<EOL><DEDENT>outfile = open(outfile, '<STR_LIT:wb>')<EOL><DEDENT>return PrintingListener(out=outfile)<EOL>
Create the listener that prints tweets