def choose(self, mol):
log.debug('<STR_LIT>')<EOL>fragments = Chem.GetMolFrags(mol, asMols=True)<EOL>largest = None<EOL>for f in fragments:<EOL><INDENT>smiles = Chem.MolToSmiles(f, isomericSmiles=True)<EOL>log.debug('<STR_LIT>', smiles)<EOL>organic = is_organic(f)<EOL>if self.prefer_organic:<EOL><INDENT>if largest and largest['<STR_LIT>'] and not organic:<EOL><INDENT>continue<EOL><DEDENT>if largest and organic and not largest['<STR_LIT>']:<EOL><INDENT>largest = None<EOL><DEDENT><DEDENT>atoms = <NUM_LIT:0><EOL>for a in f.GetAtoms():<EOL><INDENT>atoms += <NUM_LIT:1> + a.GetTotalNumHs()<EOL><DEDENT>if largest and atoms < largest['<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>weight = rdMolDescriptors.CalcExactMolWt(f)<EOL>if largest and atoms == largest['<STR_LIT>'] and weight < largest['<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>if largest and atoms == largest['<STR_LIT>'] and weight == largest['<STR_LIT>'] and smiles > largest['<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>log.debug('<STR_LIT>', smiles, atoms)<EOL>largest = {'<STR_LIT>': smiles, '<STR_LIT>': f, '<STR_LIT>': atoms, '<STR_LIT>': weight, '<STR_LIT>': organic}<EOL><DEDENT>return largest['<STR_LIT>']<EOL>
Return the largest covalent unit.

        The largest fragment is determined by number of atoms (including hydrogens). Ties are broken by taking the
        fragment with the higher molecular weight, and then by taking the first alphabetically by SMILES if needed.

        :param mol: The molecule to choose the largest fragment from.
        :type mol: rdkit.Chem.rdchem.Mol
        :return: The largest fragment.
        :rtype: rdkit.Chem.rdchem.Mol