code: def get_lock(
          end_state: NettingChannelEndState,
          secrethash: SecretHash,
  ) -> Optional[HashTimeLockState]:
      
      lock = end_state.secrethashes_to_lockedlocks.get(secrethash)
  
      if not lock:
          partial_unlock = end_state.secrethashes_to_unlockedlocks.get(secrethash)
  
          if not partial_unlock:
              partial_unlock = end_state.secrethashes_to_onchain_unlockedlocks.get(secrethash)
  
          if partial_unlock:
              lock = partial_unlock.lock
  
      assert isinstance(lock, HashTimeLockState) or lock is None
      return lock
docs: Return the lock correspoding to `secrethash` or None if the lock is
      unknown.