<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def iupacify(self):
 """Give the IUPAC conform representation. Mathematically speaking the angles in a zmatrix are representations of an equivalence class. We will denote an equivalence relation with :math:`\\sim` and use :math:`\\alpha` for an angle and :math:`\\delta` for a dihedral angle. Then the following equations hold true. .. math:: (\\alpha, \\delta) &\sim (-\\alpha, \\delta + \\pi) \\\\ \\alpha &\sim \\alpha \\mod 2\\pi \\\\ \\delta &\sim \\delta \\mod 2\\pi `IUPAC <https://goldbook.iupac.org/html/T/T06406.html>`_ defines a designated representation of these equivalence classes, by asserting: .. math:: 0 \\leq &\\alpha \\leq \\pi \\\\ -\\pi \\leq &\\delta \\leq \\pi Args: None Returns: Zmat: Zmatrix with accordingly changed angles and dihedrals. """

        def convert_d(d):
            r = d % 360
            return r - (r // 180) * 360

        new = self.copy()

        new.unsafe_loc[:, 'angle'] = new['angle'] % 360
        select = new['angle'] > 180
        new.unsafe_loc[select, 'angle'] = new.loc[select, 'angle'] - 180
        new.unsafe_loc[select, 'dihedral'] = new.loc[select, 'dihedral'] + 180

        new.unsafe_loc[:, 'dihedral'] = convert_d(new.loc[:, 'dihedral'])
        return new