code: def collect_bond_dists(mols_dict, valid_list, con_mat_list):
      """
      Collect the lengths for each type of chemical bond in given valid molecular geometries.
  
      Args:
          mol_dicts (dict): A python dict where the key is the number of atoms, and the value indexed by that key is another python dict storing the atomic
              number matrix (indexed by the key '_atomic_numbers') and the coordinate tensor (indexed by the key '_positions') of all generated molecular geometries with that atom number.
          valid_list (list): the list of bool values indicating whether each molecular geometry is chemically valid. Note that only the bond lengths of
              valid molecular geometries will be collected.
          con_mat_list (list): the list of bond order matrices.
  
      :rtype: :class:`dict` a python dict where the key is the bond type, and the value indexed by that key is the list of all bond lengths of that bond.
      """
      bond_dist = {}
      id = 0
  
      for n_atoms in mols_dict:
          numbers, positions = (
              mols_dict[n_atoms]["_atomic_numbers"],
              mols_dict[n_atoms]["_positions"],
          )
          for pos, num in zip(positions, numbers):
              if not valid_list[id]:
                  id += 1
                  continue
  
              atom_ids_1, atom_ids_2 = np.nonzero(con_mat_list[id])
              for id1, id2 in zip(atom_ids_1, atom_ids_2):
                  if id1 < id2:
                      continue
                  atomic1, atomic2 = num[id1], num[id2]
                  z1, z2 = min(atomic1, atomic2), max(atomic1, atomic2)
                  bond_type = con_mat_list[id][id1, id2]
  
                  if not (z1, z2, bond_type) in bond_dist:
                      bond_dist[(z1, z2, bond_type)] = []
                  bond_dist[(z1, z2, bond_type)].append(
                      np.linalg.norm(pos[id1] - pos[id2])
                  )
              id += 1
  
      return bond_dist
  
label_desc: Use image node_id 1 for calling a global function with example usage: collect_bond_dists(mols_dict, valid_list, con_mat_list) and returns: bond_dist