<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_monomers(self, ligands=True):
 """Retrieves all the `Monomers` from the AMPAL object. Parameters ligands : bool, optional If true, will include ligand `Monomers`. """

        if ligands and self.ligands:
            monomers = self._monomers + self.ligands._monomers
        else:
            monomers = self._monomers
        return iter(monomers)