def _as_friendly_string(s):
    """Converts a bytestring to a text string.

    To avoid encoding errors caused by arbitrary high characters (allowed in
    PICO-8 source), this replaces all high characters with underscores.

    Args:
        s: The bytestring.

    Returns:
        The text string with high characters censored, or None if s is None.
    """
    if s is None:
        return None
    s_arr = bytearray(s)
    for i, c in enumerate(s_arr):
        if c > 127:
            s_arr[i] = 95  # ASCII for b'_'
    return str(s_arr, encoding='ascii')