code: def _build_notebooks(
      limit_notebooks: Optional[Collection[str]],
      sharding: ShardingStrategy,
  ) -> None:
      # Building the notebooks is really slow. Let's time it so we know which notebooks we can /
      # should optimise.
      timings = []
      all_notebooks = sorted(
          chain(
              _NOTEBOOKS_TMP.glob("**/*.pct.py"),
              _NOTEBOOKS_TMP.glob("**/*.md"),
          )
      )
      for i, source_path in enumerate(all_notebooks):
          before = perf_counter()
          print()
          print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
          print("Building:", source_path)
          print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
  
          source_relative_path = source_path.relative_to(_NOTEBOOKS_TMP)
          destination_relative_path = source_relative_path
          while (
              destination_relative_path.suffix
          ):  # .pct.py has several suffixes. Remove all of them.
              destination_relative_path = (
                  destination_relative_path.with_suffix("")
              )
          destination_relative_path = (
              destination_relative_path.with_suffix(".ipynb")
          )
  
          if i % sharding.shard_n != sharding.shard_i:
              print("Skipping due to sharding...")
          elif (
              limit_notebooks is None
              or destination_relative_path.stem in limit_notebooks
          ):
              subprocess.run(
                  [
                      "jupytext",
                      "--execute",
                      "--to",
                      "notebook",
                      "-o",
                      str(destination_relative_path),
                      str(source_relative_path),
                  ],
                  cwd=_NOTEBOOKS_TMP,
              ).check_returncode()
              _post_process_ipynb(destination_relative_path)
          else:
              _create_fake_notebook(
                  destination_relative_path, limit_notebooks
              )
  
          after = perf_counter()
          timings.append((after - before, source_relative_path))
  
      timings.sort(reverse=True)
      print()
      print("Notebooks by build-time:")
      print(tabulate(timings, headers=["Time", "Notebook"]))
      print()
  
file_path: GPflow/doc/build_docs.py
imports: import argparse
  import json
  import shutil
  import subprocess
  from datetime import datetime
  from itertools import chain
  from pathlib import Path
  from time import perf_counter
  from typing import Collection, Optional, Union
  from generate_module_rst import generate_module_rst
  from tabulate import tabulate
  from versions import Branch
  import gpflow
label_desc: Use image node_id 3 for calling a global function with example usage: _build_notebooks(limit_notebooks, sharding) without return types