def get_function(func_name, modules):
    """
    Searches for the function func_name in the modules list. Name can or cannot be given fully qualified

    :param func_name: string, the function name being searched
    :param modules: the list of modules created by :func:`get_submodules_of`
    :return: function object or None
    """

    # Check if fully qualified name given
    if func_name.find('.') != -1:
        split_name = func_name.rsplit('.', 1)
        func_name = split_name[-1]
        module_name = split_name[-2]

        the_module = next((e for e in modules if e['module_name'] == module_name), None)
        try:
            if the_module:
                return getattr(the_module['module_object'], func_name)
            else:
                return None
        except AttributeError:
            return None
    else:
        for the_module in modules:
            for func_dict in the_module['functions']:
                if func_name == func_dict['function_name']:
                    return func_dict['function_object']

    return None