<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compute_merkletree_with( merkletree: MerkleTreeState, lockhash: LockHash, ) -> Optional[MerkleTreeState]: """Register the given lockhash with the existing merkle tree."""

    # 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