<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unique_id(self):
 """Generates a tuple that uniquely identifies a `Monomer` in an `Assembly`. Notes ----- The unique_id will uniquely identify each monomer within a polymer. If each polymer in an assembly has a distinct id, it will uniquely identify each monomer within the assembly. The hetero-flag is defined as in Biopython as a string that is either a single whitespace in the case of a non-hetero atom, or 'H_' plus the name of the hetero-residue (e.g. 'H_GLC' in the case of a glucose molecule), or 'W' in the case of a water molecule. For more information, see the Biopython documentation or this Biopython wiki page: http://biopython.org/wiki/The_Biopython_Structural_Bioinformatics_FAQ Returns ------- unique_id : tuple unique_id[0] is the polymer_id unique_id[1] is a triple of the hetero-flag, the monomer id (residue number) and the insertion code. """

        if self.is_hetero:
            if self.mol_code == 'HOH':
                hetero_flag = 'W'
            else:
                hetero_flag = 'H_{0}'.format(self.mol_code)
        else:
            hetero_flag = ' '
        return self.ampal_parent.id, (hetero_flag, self.id, self.insertion_code)