def function_or_class_name(obj):
    """
    Given a callable, try to determine its name. Return 'None' if None.
    """
    try:
        return obj.__name__
    except AttributeError:
        return obj.__class__.__name__
