code: def execute_catboost_dist(mode, cmd):
      hosts_path = yatest.common.test_output_path("hosts.txt")
      with yatest.common.network.PortManager() as pm:
          port0 = pm.get_port()
          port1 = pm.get_port()
          with open(hosts_path, "w") as hosts:
              hosts.write("localhost:" + str(port0) + "\n")
              hosts.write("localhost:" + str(port1) + "\n")
  
          catboost_path = yatest.common.binary_path(
              "catboost/app/catboost"
          )
          worker0 = yatest.common.execute(
              (
                  catboost_path,
                  "run-worker",
                  "--node-port",
                  str(port0),
              ),
              wait=False,
          )
          worker1 = yatest.common.execute(
              (
                  catboost_path,
                  "run-worker",
                  "--node-port",
                  str(port1),
              ),
              wait=False,
          )
          while pm.is_port_free(port0) or pm.is_port_free(port1):
              time.sleep(1)
  
          execute_catboost(
              mode,
              "CPU",
              cmd
              + (
                  "--node-type",
                  "Master",
                  "--file-with-hosts",
                  hosts_path,
              ),
          )
          worker0.wait()
          worker1.wait()
  
imports: import os
  import pytest
  import re
  import sys
  import tempfile
  import time
  from .common_helpers import *
  import zipfile
  from testpath.tempdir import TemporaryDirectory
  import yatest.common.network
label_desc: Use image node_id 10 for calling a global function with example usage: execute_catboost_dist(mode, cmd) without return types