docs: def calculate_merkle_pairs(bin_hashes, hash_function=bin_double_sha256):
      """
      Calculate the parents of a row of a merkle tree.
      Takes in a list of binary hashes, returns a binary hash.
  
      The returned parents list is such that parents[i] == hash(bin_hashes[2*i] + bin_hashes[2*i+1]).
      """
      hashes = list(bin_hashes)
  
      # if there are an odd number of hashes, double up the last one
      if len(hashes) % 2 == 1:
          hashes.append(hashes[-1])
  
      new_hashes = []
      for i in range(0, len(hashes), 2):
          new_hashes.append(hash_function(hashes[i] + hashes[i+1]))
  
      return new_hashes