import re


def printable(text):
    """
    Convert text to only printable characters, as a user would see it.
    """

    ansi = re.compile(r'\x1b\[[^Jm]*[Jm]')
    return ansi.sub('', text).rstrip()