def is_ascii(text: str) -> bool:
    """ Check if a string contains ascii character only. """
    if isinstance(text, str):
        try:
            text.encode("ascii")
        except UnicodeEncodeError:
            return False
    else:
        try:
            text.decode("ascii")
        except UnicodeDecodeError:
            return False
    return True