docs: def get_all_subclasses(typ, recursive: bool = True, _memo = None) -> Sequence[Type[Any]]:
      """
      Returns all subclasses, and supports generic types. It is recursive by default
      See discussion at https://github.com/Stewori/pytypes/issues/31
  
      :param typ:
      :param recursive: a boolean indicating whether recursion is needed
      :param _memo: internal variable used in recursion to avoid exploring subclasses that were already explored
      :return:
      """
      _memo = _memo or set()
  
      # if we have collected the subclasses for this already, return
      if typ in _memo:
          return []
  
      # else remember that we have collected them, and collect them
      _memo.add(typ)
      if is_generic_type(typ):
          # We now use get_origin() to also find all the concrete subclasses in case the desired type is a generic
          sub_list = get_origin(typ).__subclasses__()
      else:
          sub_list = typ.__subclasses__()
  
      # recurse
      result = []
      for t in sub_list:
          # only keep the origins in the list
          to = get_origin(t) or t
          try:
              if to is not typ and to not in result and is_subtype(to, typ, bound_typevars={}):
                  result.append(to)
          except:
              # catching an error with is_subtype(Dict, Dict[str, int], bound_typevars={})
              pass
  
      # recurse
      if recursive:
          for typpp in sub_list:
              for t in get_all_subclasses(typpp, recursive=True, _memo=_memo):
                  # unfortunately we have to check 't not in sub_list' because with generics strange things happen
                  # also is_subtype returns false when the parent is a generic
                  if t not in sub_list and is_subtype(t, typ, bound_typevars={}):
                      result.append(t)
  
      return result