<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_sharing_keys(self, keys):
 """ Set the keys to share or unshare Parameters keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to share all formatoptions of that group (see the :attr:`fmt_groups` property). If None, all formatoptions of this plotter are inserted. Returns ------- set The set of formatoptions to share (or unshare)"""

        if isinstance(keys, str):
            keys = {keys}
        keys = set(self) if keys is None else set(keys)
        fmto_groups = self._fmto_groups
        keys.update(chain(*(map(lambda fmto: fmto.key, fmto_groups[key])
                            for key in keys.intersection(fmto_groups))))
        keys.difference_update(fmto_groups)
        return keys