def __init__(self, filename=None):
        self.filename = None
        if filename:
            self.load(filename)
def lock_temp(self, key):
    self.lock(key)
    try:
      yield
    finally:
      self.unlock(key)