def get_name(func):
    """
    Returns the name of a callable.

    It handles different types of callable: function, callable object with
    ``__call__`` method and callable objects that provide their name in the
    ``name`` attributes.

    :type func: callable.
    :returns:
        :rtype: str.

    """
    prefix = func.__module__
    if not callable(func):
        raise ValueError('{} is not callable'.format(func))
    if hasattr(func, 'name'):
        name = func.name
    elif hasattr(func, '__name__'):
        name = func.__name__
    else:
        name = func.__class__.__name__
    return '.'.join([prefix, name])
