docs: def _get_commands(dist  # type: setuptools.dist.Distribution
                    ):
      # type: (...) -> typing.Dict[str, typing.Set[str]]
      """Find all commands belonging to the given distribution.
  
      Args:
          dist: The Distribution to search for docopt-compatible docstrings that
              can be used to generate command entry points.
  
      Returns:
          A dictionary containing a mapping of primary commands to sets of
          subcommands.
      """
      py_files = (f for f in setuptools.findall()
                  if os.path.splitext(f)[1].lower() == '.py')
      pkg_files = (f for f in py_files if _get_package_name(f) in dist.packages)
      commands = {}  # type: typing.Dict[str, typing.Set[str]]
      for file_name in pkg_files:
          with open(file_name) as py_file:
              module = typing.cast(ast.Module, ast.parse(py_file.read()))
          module_name = _get_module_name(file_name)
          _append_commands(commands, module_name, _get_module_commands(module))
          _append_commands(commands, module_name, _get_class_commands(module))
          _append_commands(commands, module_name, _get_function_commands(module))
      return commands