def open_logfile(filename, mode='<STR_LIT:a>'):
filename = os.path.expanduser(filename)<EOL>filename = os.path.abspath(filename)<EOL>dirname = os.path.dirname(filename)<EOL>if not os.path.exists(dirname):<EOL><INDENT>os.makedirs(dirname)<EOL><DEDENT>exists = os.path.exists(filename)<EOL>log_fp = open(filename, mode)<EOL>if exists:<EOL><INDENT>log_fp.write('<STR_LIT>' % ('<STR_LIT:->'*<NUM_LIT>))<EOL>log_fp.write('<STR_LIT>' % (sys.argv[<NUM_LIT:0>], time.strftime('<STR_LIT>')))<EOL><DEDENT>return log_fp<EOL>
Open the named log file in append mode.

    If the file already exists, a separator will also be printed to
    the file to separate past activity from current activity.