def delete_after(filename):
def delete_after_decorator(function):<EOL><INDENT>def wrapper(*args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>return function(*args, **kwargs)<EOL><DEDENT>finally:<EOL><INDENT>if os.path.isfile(filename):<EOL><INDENT>os.remove(filename)<EOL><DEDENT>if os.path.isdir(filename):<EOL><INDENT>shutil.rmtree(filename)<EOL><DEDENT><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return delete_after_decorator<EOL>
Decorator to be sure the file given by parameter is deleted after the
    execution of the method.