def METHOD_NAME(self, f):
    # close and remove file
    if f is None:
        return
    try:
        f.close()
    except (SystemExit, KeyboardInterrupt):
        raise
    except:
        pass
    try:
        os.unlink(f.name)
    except (SystemExit, KeyboardInterrupt):
        raise
    except:
        pass