<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def known_scope_infos(cls):
 """Yield ScopeInfo for all known scopes for this optionable, in no particular order. :rtype: set of :class:`pants.option.scope.ScopeInfo` :raises: :class:`pants.subsystem.subsystem_client_mixin.SubsystemClientMixin.CycleException` if a dependency cycle is detected. """

    known_scope_infos = set()
    optionables_path = OrderedSet()  #  To check for cycles at the Optionable level, ignoring scope.

    def collect_scope_infos(optionable_cls, scoped_to, removal_version=None, removal_hint=None):
      if optionable_cls in optionables_path:
        raise cls.CycleException(list(optionables_path) + [optionable_cls])
      optionables_path.add(optionable_cls)

      scope = (optionable_cls.options_scope if scoped_to == GLOBAL_SCOPE
               else optionable_cls.subscope(scoped_to))
      scope_info = ScopeInfo(
          scope,
          optionable_cls.options_scope_category,
          optionable_cls,
          removal_version=removal_version,
          removal_hint=removal_hint
        )

      if scope_info not in known_scope_infos:
        known_scope_infos.add(scope_info)
        for dep in scope_info.optionable_cls.subsystem_dependencies_iter():
          # A subsystem always exists at its global scope (for the purpose of options
          # registration and specification), even if in practice we only use it scoped to
          # some other scope.
          #
          # NB: We do not apply deprecations to this implicit global copy of the scope, because if
          # the intention was to deprecate the entire scope, that could be accomplished by
          # deprecating all options in the scope.
          collect_scope_infos(dep.subsystem_cls, GLOBAL_SCOPE)
          if not dep.is_global():
            collect_scope_infos(dep.subsystem_cls,
                                scope,
                                removal_version=dep.removal_version,
                                removal_hint=dep.removal_hint)

      optionables_path.remove(scope_info.optionable_cls)

    collect_scope_infos(cls, GLOBAL_SCOPE)
    return known_scope_infos