def format_unprintable(string):
    """Escape tabs (\\t), newlines (\\n), etc. for system commands and printing.

    Examples
    --------
    >>> format_unprintable('\\t')
    '\\\\t'
    """
    return repr(string).strip("'")
