Display the data attributes of an object in a readable format

def show(x):
    """Display the data attributes of an object in a readable format"""
    print("data attributes of %r" % (x,))
    names = dir(x)
    maxlen = max([0] + [len(n) for n in names])
    for k in names:
        v = getattr(x, k)
        if isinstance(v, types.MethodType):
            continue
        if k[:2] == '__' and k[-2:] == '__':
            continue
        if isinstance(v, str):
            if len(v) > 80 - maxlen - 5:
                v = repr(v[:80 - maxlen - 5]) + "..."
        elif isinstance(v, (int, type(None))):
            v = str(v)
        elif isinstance(v, (list, tuple, dict)):
            v = "%s (%d elements)" % (v, len(v))
        else:
            v = str(type(v))
        print("%*s : %s" % (maxlen, k, v))
    return x