Strip ANSI escape sequences from a string
strip-ansi is available on on PyPI:
pip install strip_ansi
Warning
This package only supports python 3.6 and up. It may work on older versions (maybe even python 2) but I'm not sure.
>>> from strip_ansi import strip_ansi
>>> strip_ansi("\033[38mLorem ipsum\033[0m")
"Lorem ipsum"