code: def write_requirements(cmd, basename, filename):
      dist = cmd.distribution
      data = io.StringIO()
      install_requires, extras_require = _prepare(
          dist.install_requires or (), dist.extras_require or {}
      )
      _write_requirements(data, install_requires)
      for extra in sorted(extras_require):
          data.write("\n[{extra}]\n".format(**vars()))
          _write_requirements(data, extras_require[extra])
      cmd.write_or_delete_file(
          "requirements", filename, data.getvalue()
      )
  
file_path: catboost/contrib/python/setuptools/py3/setuptools/command/_requirestxt.py
imports: import io
  from collections import defaultdict
  from itertools import filterfalse
  from typing import Dict, List, Tuple, Mapping, TypeVar
  from ..None import _reqs
  from ..extern.jaraco.text import yield_lines
  from ..extern.packaging.requirements import Requirement
label_desc: Use image node_id 8 for calling a global function with example usage: write_requirements(cmd, basename, filename) without return types