<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _fmto_groups(self):
 """Mapping from group to a set of formatoptions"""

        ret = defaultdict(set)
        for key in self:
            ret[getattr(self, key).group].add(getattr(self, key))
        return dict(ret)