code: def compute_merkle_tree(items: Iterable[bytes]) -> MerkleTree:
      
  
      if not all(isinstance(l, bytes) and len(l) == 32 for l in items):
          raise ValueError('Not all items are hashes')
  
      leaves = sorted(items)
      if len(leaves) == 0:
          return MerkleTree(layers=[[EMPTY_MERKLE_ROOT]])
  
      if not len(leaves) == len(set(leaves)):
          raise ValueError('The leaves items must not contain duplicate items')
  
      tree = [leaves]
      layer = leaves
      while len(layer) > 1:
          # [a, b, c, d, e] -> [(a, b), (c, d), (e, None)]
          iterator = iter(layer)
          paired_items = zip_longest(iterator, iterator)
  
          layer = [_hash_pair(a, b) for a, b in paired_items]
          tree.append(layer)
  
      return MerkleTree(layers=tree)
docs: Calculates the merkle root for a given list of items