def name(obj):
    """ return name of an object (type). """
    t = str(type(obj))
    s = str(obj)
    if 'function' in t:
        pre, post = s.split(' at ', 1)
        pre, post = pre.split()
        name = "<function '" + post + "'>"
    elif 'module' in t:
        pre, post = s.split(' from ', 1)
        name = '<' + pre[1:] + '>'
    elif 'class' in t:
        if 'method' in t:
            pre, post = s.split(' of ', 1)
            name = "<method '" + pre.split()[-1] + "'>"
        else:
            pre, post = t.split('class ', 1)
            name = "<class '" + post[:-1][1:-1] + "'>"
    elif 'built-in' in t:
        name = '<' + t + '>'
    return name
