<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_by_types(self):
 """Iterate over species grouped by type"""

        for t in self.types_of_specie:
            for site in self:
                if site.specie == t:
                    yield site