code: def identify_kmers(self, residues):
          
  
          # Remove all those not considered by ligands and pairings including alternate conformations
          ligdoubles = [[(link.id1, link.chain1, link.pos1),
                         (link.id2, link.chain2, link.pos2)] for link in
                        [c for c in self.covalent if c.id1 in self.lignames_kept and c.id2 in self.lignames_kept
                         and c.conf1 in ['A', ''] and c.conf2 in ['A', '']
                         and (c.id1, c.chain1, c.pos1) in residues
                         and (c.id2, c.chain2, c.pos2) in residues]]
          kmers = cluster_doubles(ligdoubles)
          if not kmers:  # No ligand kmers, just normal independent ligands
              return [[residues[res]] for res in residues]
  
          else:
              # res_kmers contains clusters of covalently bound ligand residues (kmer ligands)
              res_kmers = [[residues[res] for res in kmer] for kmer in kmers]
  
              # In this case, add other ligands which are not part of a kmer
              in_kmer = []
              for res_kmer in res_kmers:
                  for res in res_kmer:
                      in_kmer.append((res.GetName(), res.GetChain(), res.GetNum()))
              for res in residues:
                  if res not in in_kmer:
                      newres = [residues[res], ]
                      res_kmers.append(newres)
              return res_kmers
docs: Using the covalent linkage information, find out which fragments/subunits form a ligand.