Make lock.py compatible with python 2.6

2.7 isn't available on old debian boxes