<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_merkleproof_for(merkletree: 'MerkleTreeState', element: Keccak256) -> List[Keccak256]: """ Containment proof for element. The proof contains only the entries that are sufficient to recompute the merkleroot, from the leaf `element` up to `root`. Raises: IndexError: If the element is not part of the merkletree. """

    idx = merkletree.layers[LEAVES].index(element)

    proof = []
    for layer in merkletree.layers:
        if idx % 2:
            pair = idx - 1
        else:
            pair = idx + 1

        # with an odd number of elements the rightmost one does not have a pair.
        if pair < len(layer):
            proof.append(layer[pair])

        # the tree is binary and balanced
        idx = idx // 2

    return proof