def METHOD_NAME(benchmarks, data_stream, output_dir):
    benchmark_titles = {id_: data.title for id_, data in benchmarks.items()}
    product = list(benchmarks.values())[0].product
    input_basename = os.path.basename(data_stream)
    index_links = make_index_links(benchmarks)
    index_options = make_index_options(benchmarks)
    index_initial_src = make_index_initial_src(benchmarks)
    index_source = ssg.build_guides.build_index(
        benchmark_titles, input_basename, index_links, index_options,
        index_initial_src)
    output_path = make_output_file_path("index", product, output_dir)
    with open(output_path, "wb") as f:
        f.write(index_source.encode("utf-8"))