def make_callable(funcname):
    """
    Return a callable object from a string.

    This function resolves a name into a callable object. It automatically
    loads the required modules. If there is no module path, it considers the
    callable is a builtin.

    :param funcname: name of the callable.
    :type  funcname: str.

    :returns:
        :rtype: callable.

    Examples
    --------

    Loading a function from a library:

    >>> func = make_callable('itertools.chain')
    >>> list(func(range(3), range(4)))
    [0, 1, 2, 0, 1, 2, 3]

    Loading a builtin:

    >>> func = make_callable('map')
    >>> list(func(lambda x: x + 1, range(4)))
    [1, 2, 3, 4]

    """
    if '.' not in funcname:
        module_name = 'builtins'
        object_name = funcname
    else:
        module_name, object_name = funcname.rsplit('.', 1)

    module = __import__(module_name, fromlist=['*'])
    try:
        callable_ = getattr(module, object_name)
    except AttributeError:
        raise AttributeError('module {} has no attribute {}'.format(
            module.__name__,
            object_name,
        ))
    return callable_