code: def release(self):
          
          me = threading.currentThread()
          self.__condition.acquire()
          try:
              if self.__writer is me:
                  self.__writer_lock_count -= 1
                  if self.__writer_lock_count == 0:
                      self.__writer = None
                      self.__condition.notifyAll()
              elif me in self.__readers:
                  self.__readers[me] -= 1
                  if self.__readers[me] == 0:
                      del self.__readers[me]
                      if not self.__readers:
                          self.__condition.notifyAll()
              else:
                  raise thread.error, "release unlocked lock"
          finally:
              self.__condition.release()
docs: Release the currently held lock.
  
          In case the current thread holds no lock, a thread.error
          is thrown.