def get_function(fn_or_name, module_paths=None):
    'Returns the function of specified name and module.\n\n    Args:\n        fn_or_name (str or callable): Name or full path to a function, or the\n            function itself.\n        module_paths (list, optional): A list of paths to candidate modules to\n            search for the function. This is used only when the function\n            cannot be located solely based on :attr:`fn_or_name`. The first\n            module in the list that contains the function is used.\n\n    Returns:\n        A function.\n    '
    if is_callable(fn_or_name):
        return fn_or_name
    fn = locate(fn_or_name)
    if ((fn is None) and (module_paths is not None)):
        for module_path in module_paths:
            fn = locate('.'.join([module_path, fn_or_name]))
            if (fn is not None):
                break
    if (fn is None):
        raise ValueError('Method not found in {}: {}'.format(module_paths, fn_or_name))
    return fn
Returns the function of specified name and module.

Args:
    fn_or_name (str or callable): Name or full path to a function, or the
        function itself.
    module_paths (list, optional): A list of paths to candidate modules to
        search for the function. This is used only when the function
        cannot be located solely based on :attr:`fn_or_name`. The first
        module in the list that contains the function is used.

Returns:
    A function.
def get_function(fn_or_name, module_paths=None):
    'Returns the function of specified name and module.\n\n    Args:\n        fn_or_name (str or callable): Name or full path to a function, or the\n            function itself.\n        module_paths (list, optional): A list of paths to candidate modules to\n            search for the function. This is used only when the function\n            cannot be located solely based on :attr:`fn_or_name`. The first\n            module in the list that contains the function is used.\n\n    Returns:\n        A function.\n    '
    if is_callable(fn_or_name):
        return fn_or_name
    fn = locate(fn_or_name)
    if ((fn is None) and (module_paths is not None)):
        for module_path in module_paths:
            fn = locate('.'.join([module_path, fn_or_name]))
            if (fn is not None):
                break
    if (fn is None):
        raise ValueError('Method not found in {}: {}'.format(module_paths, fn_or_name))
    return fn