@classmethod
def _summarize_bytes(cls, data, max_len=24):
    """Avoid spamming logs by truncating byte strings in repr."""
    if len(data) > max_len:
        return '{!r} + {} bytes'.format(data[:max_len], len(data) - max_len)
    return repr(data)
