def pickle_dump(data, filename):
fh = open(filename, '<STR_LIT:w>')<EOL>try:<EOL><INDENT>pickle.dump(data, fh)<EOL><DEDENT>finally:<EOL><INDENT>fh.close()<EOL><DEDENT>
Equivalent to pickle.dump(data, open(filename, 'w'))
but closes the file to prevent filehandle leakage.