Sounds good. I've created two version, one with global utilising the locks, and one just creating local variable. I prefer local variables as I think this is cleaner, and the only notable creation/deletion overhead of IO is only during start up or shutdown of fail2ban. Luckily, the `tempfile.TemporaryFile`[1] handles all the deletion once the file is closed :smile:

https://gist.github.com/kwirk/5484839
https://gist.github.com/kwirk/5484915

What do you think?

[1]: http://docs.python.org/2/library/tempfile.html#tempfile.TemporaryFile