code: def get_known_codes(
          s: Union[str, 'Colr'],
          unique: Optional[bool] = True,
          rgb_mode: Optional[bool] = False):
      
  
      isdisabled = disabled()
      orderedcodes = tuple((c, get_known_name(c)) for c in get_codes(s))
      codesdone = set()  # type: Set[str]
  
      for code, codeinfo in orderedcodes:
          # Do the codes in order, but don't do the same code twice.
  
          if unique:
              if code in codesdone:
                  continue
              codesdone.add(code)
  
          if codeinfo is None:
              continue
          codetype, name = codeinfo
  
          typedesc = '{:>13}: {!r:<23}'.format(codetype.title(), code)
          if codetype.startswith(('extended', 'rgb')):
              if isdisabled:
                  codedesc = str(ColorCode(name, rgb_mode=rgb_mode))
              else:
                  codedesc = ColorCode(name, rgb_mode=rgb_mode).example()
          else:
              codedesc = ''.join((
                  code,
                  str(name).lstrip('(').rstrip(')'),
                  codes['style']['reset_all']
              ))
  
          yield ' '.join((
              typedesc,
              codedesc
          ))
docs: Get all known escape codes from a string, and yield the explanations.