<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def proc_chain(self, chain_info, parent):
 """Converts a chain into a `Polymer` type object. Parameters chain_info : (set, OrderedDict) Contains a set of chain labels and atom records. parent : ampal.Assembly `Assembly` used to assign `ampal_parent` on created `Polymer`. Raises ------ ValueError Raised if multiple or unknown atom types found within the same chain. AttributeError Raised if unknown `Monomer` type encountered. """

        hetatom_filters = {
            'nc_aas': self.check_for_non_canonical
        }

        polymer = False
        chain_labels, chain_data = chain_info
        chain_label = list(chain_labels)[0]
        monomer_types = {x[2] for x in chain_labels if x[2]}
        if ('P' in monomer_types) and ('N' in monomer_types):
            raise ValueError(
                'Malformed PDB, multiple "ATOM" types in a single chain.')
        # Changes Polymer type based on chain composition
        if 'P' in monomer_types:
            polymer_class = Polypeptide
            polymer = True
        elif 'N' in monomer_types:
            polymer_class = Polynucleotide
            polymer = True
        elif 'H' in monomer_types:
            polymer_class = LigandGroup
        else:
            raise AttributeError('Malformed parse tree, check inout PDB.')
        chain = polymer_class(polymer_id=chain_label[0], ampal_parent=parent)
        # Changes where the ligands should go based on the chain composition
        if polymer:
            chain.ligands = LigandGroup(
                polymer_id=chain_label[0], ampal_parent=parent)
            ligands = chain.ligands
        else:
            ligands = chain

        for residue in chain_data.values():
            res_info = list(residue[0])[0]
            if res_info[0] == 'ATOM':
                chain._monomers.append(self.proc_monomer(residue, chain))
            elif res_info[0] == 'HETATM':
                mon_cls = None
                on_chain = False
                for filt_func in hetatom_filters.values():
                    filt_res = filt_func(residue)
                    if filt_res:
                        mon_cls, on_chain = filt_res
                        break
                    mon_cls = Ligand
                if on_chain:
                    chain._monomers.append(self.proc_monomer(
                        residue, chain, mon_cls=mon_cls))
                else:
                    ligands._monomers.append(self.proc_monomer(
                        residue, chain, mon_cls=mon_cls))
            else:
                raise ValueError('Malformed PDB, unknown record type for data')
        return chain