def gen_result_wrapper(kls):
    'Generate a result wrapper.'

    class Wrapper(kls, ResultWrapper):
        'Wrapper of a kls that can store render_result.'

        def __init__(self, *args: tuple, render_result: (str | None)=None) -> None:
            super().__init__(*args)
            self.render_result = render_result

        def __str__(self) -> str:
            if (self.render_result is None):
                if (kls is set):
                    return str(set(self))
                return cast(str, kls.__str__(self))
            return self.render_result
    return Wrapper
Generate a result wrapper.
def gen_result_wrapper(kls):
    

    class Wrapper(kls, ResultWrapper):
        'Wrapper of a kls that can store render_result.'

        def __init__(self, *args: tuple, render_result: (str | None)=None) -> None:
            super().__init__(*args)
            self.render_result = render_result

        def __str__(self) -> str:
            if (self.render_result is None):
                if (kls is set):
                    return str(set(self))
                return cast(str, kls.__str__(self))
            return self.render_result
    return Wrapper