code: def compute_merkletree_with(
          merkletree: MerkleTreeState,
          lockhash: LockHash,
  ) -> Optional[MerkleTreeState]:
      
      # Use None to inform the caller the lockshash is already known
      result = None
  
      leaves = merkletree.layers[LEAVES]
      if lockhash not in leaves:
          leaves = list(leaves)
          leaves.append(Keccak256(lockhash))
          result = MerkleTreeState(compute_layers(leaves))
  
      return result
docs: Register the given lockhash with the existing merkle tree.