def _str_trunc(x):
    """Helper function of :func:`recursive_diff`.

    Convert x to string. If it is longer than 80 characters, or spans
    multiple lines, truncate it
    """
    x = str(x)
    if len(x) <= 80 and '\n' not in x:
        return x
    return x.splitlines()[0][:76] + ' ...'
