def summarize_attr(key, value, col_width=None):
    """Summary for __repr__ - use ``X.attrs[key]`` for full value."""
    # Indent key and add ':', then right-pad if col_width is not None
    k_str = '    {}:'.format(key)
    if col_width is not None:
        k_str = pretty_print(k_str, col_width)
    # Replace tabs and newlines, so we print on one line in known width
    v_str = str(value).replace('\t', '\\t').replace('\n', '\\n')
    # Finally, truncate to the desired display width
    return maybe_truncate('{} {}'.format(k_str, v_str),
                          OPTIONS['display_width'])