def dump_compile(codeobject, filename, timestamp, magic):
<EOL>path_tmp = '<STR_LIT>' % (filename, id(filename))<EOL>fc = None<EOL>try:<EOL><INDENT>fc = open(path_tmp, '<STR_LIT:wb>')<EOL>if PYTHON3:<EOL><INDENT>fc.write(bytes([<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>fc.write('<STR_LIT>')<EOL><DEDENT>wr_long(fc, timestamp)<EOL>marshal.dump(codeobject, fc)<EOL>fc.flush()<EOL>fc.seek(<NUM_LIT:0>, <NUM_LIT:0>)<EOL>fc.write(magic)<EOL>fc.close()<EOL>os.rename(path_tmp, filename)<EOL><DEDENT>except OSError:<EOL><INDENT>try:<EOL><INDENT>os.unlink(path_tmp)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>raise<EOL><DEDENT>finally:<EOL><INDENT>if fc: fc.close()<EOL><DEDENT>
Write code object as a byte-compiled file

    Arguments:
    codeobject: code object
    filefile: bytecode file to write
    timestamp: timestamp to put in file
    magic: Pyton bytecode magic