def name_of(obj):
    """Returns the name of function or class."""
    class_name = type(obj).__name__
    if class_name in ['function', 'type']:
        return obj.__name__
    else:
        return class_name