def import_attr(module_name, attr_name):
    """
    Given a dotted Python path & an attribute name, imports the module &
    returns the attribute.

    If not found, raises ``UnknownCallableError``.

    Ex::

        choice = import_attr('random', 'choice')

    :param module_name: The dotted Python path
    :type module_name: string

    :param attr_name: The attribute name
    :type attr_name: string

    :returns: attribute
    """
    module = import_module(module_name)

    try:
        return getattr(module, attr_name)
    except __HOLE__ as err:
        raise UnknownCallableError(str(err))
dataset/ETHPy150Open toastdriven/alligator/alligator/utils.py/import_attr