import string


def isprintable(data) -> bool:
    """
    This is a convenience function to be used rather than the usual
    ``str.printable`` boolean value, as that built-in **DOES NOT** consider
    newlines to be part of the printable data set (weird!)
    """

    if type(data) is str:
        data = data.encode("utf-8")
    return all(c in bytes(string.printable, "ascii") for c in data)