from typing import Tuple
import string


def _lex_char_or_cs(text: str) -> Tuple[str, str]:
    """Look atthe beginning of the given text and trim either a byte, or
    an ANSI control sequence from the beginning, returning a tuple
    ("char-or-cs", "remaining-text").  If it looks like the text is a
    truncated control seqence, then it doesn't trim anything, and
    returns ("", "original"); signaling that it needs to wait for more
    input before successfully lexing anything.
    """
    if text == '\033':
        # wait to see if this is a control sequence
        return '', text
    i = 1
    if text.startswith('\033['):
        try:
            i = len('\033[')
            while text[i] not in string.ascii_letters:
                i += 1
            i += 1
        except IndexError:
            # wait for a complete control sequence
            return '', text
    return text[:i], text[i:]