def METHOD_NAME(encoding_name: str) -> Generator[None, None, None]:
    old_encoding = 'ascii'  # Default fallback value
    try:
        old_encoding = urwid.util._target_encoding
        urwid.set_encoding(encoding_name)
        yield
    finally:
        urwid.set_encoding(old_encoding)