def process_code_info(analysis, extensions):
    """Processes FileInformation objects into dictionary described below

    Structure of the dictionary produced by this tool is:
    {
        <file_name>: {
            "nloc": <file.nloc>,
            "average_nloc": <file.average_NLOC>,
            "average_tokens": <file.average_token>,
            "average_ccn": <file.average_CCN>,
            <function_name>: {
               "nloc": <FunctionInfo.nloc>,
               "ccn": <FunctionInfo.cyclomatic_complexity>,
               "tokens": <FunctionInfo.token_count>,
               "parameters": <FunctionInfo.parameter_count>,
               "start_line": <FunctionInfo.start_line>,
               "end_line": <FunctionInfo.end_line>,
               "length": <FunctionInfo.length>
            }
            # functions can then be repeated until all are included
        }
    }
    """
    data_dict= {}
    for module_info in analysis:
        data_dict[module_info.filename] = {}
        file_name = module_info.filename
        data_dict[file_name]["nloc"] = module_info.nloc
        data_dict[file_name]["average_nloc"] = module_info.average_NLOC
        data_dict[file_name]["average_tokens"] = module_info.average_token
        data_dict[file_name]["average_ccn"] = module_info.average_CCN

        for extension in extensions:
            if hasattr(extension, 'reduce'):
                extension.reduce(module_info)
        if module_info:
            #all_functions.append(module_info)
            for fun in module_info.function_list:
                name1 = module_info.filename
                name2 = fun.name
                data_dict[name1][name2] = {}
                data_dict[name1][name2]["nloc"] = fun.nloc
                data_dict[name1][name2]["ccn"] = fun.cyclomatic_complexity
                data_dict[name1][name2]["tokens"] = fun.token_count
                data_dict[name1][name2]["parameters"] = fun.parameter_count
                data_dict[name1][name2]["start_line"] = fun.start_line
                data_dict[name1][name2]["end_line"] = fun.end_line
                data_dict[name1][name2]["length"] = fun.length

    return data_dict