code: def merkleroot(merkletree: 'MerkleTreeState') -> Locksroot:
      
      assert merkletree.layers, 'the merkle tree layers are empty'
      assert merkletree.layers[MERKLEROOT], 'the root layer is empty'
  
      return Locksroot(merkletree.layers[MERKLEROOT][0])
docs: Return the root element of the merkle tree.