code: def release_save(lock):
      
      if hasattr(lock, '_release_save'):
          return lock._release_save()
      elif hasattr(lock, 'release'):
          lock.release()
      else:
          raise TypeError('expecting Lock/RLock')
docs: Release a lock and return its state.