code: def get_secret(
          end_state: NettingChannelEndState,
          secrethash: SecretHash,
  ) -> Optional[Secret]:
      
      partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash)
  
      if partial_unlock_proof is None:
          partial_unlock_proof = end_state.secrethashes_to_onchain_unlockedlocks.get(secrethash)
  
      if partial_unlock_proof is not None:
          return partial_unlock_proof.secret
  
      return None
docs: Returns `secret` if the `secrethash` is for a lock with a known secret.