code: def _canonical_execute(
      excutor,
      kwargs,
      file_name,
      save_locally,
      diff_tool,
      diff_file_name,
      diff_tool_timeout,
      data_transformer,
  ):
      res = excutor(**kwargs)
      command = kwargs["command"]
      file_name = file_name or process.get_command_name(command)
      if file_name.endswith(".exe"):
          file_name = os.path.splitext(file_name)[
              0
          ]  # don't want to bring windows stuff in file names
      out_file_path = path.get_unique_file_path(
          runtime.output_path(), "{}.out.txt".format(file_name)
      )
      err_file_path = path.get_unique_file_path(
          runtime.output_path(), "{}.err.txt".format(file_name)
      )
      if not data_transformer:
  
          def data_transformer(x):
              return x
  
      try:
          os.makedirs(os.path.dirname(out_file_path))
      except OSError:
          pass
  
      with open(out_file_path, "wb") as out_file:
          yatest_logger.debug("Will store file in %s", out_file_path)
          out_file.write(data_transformer(res.std_out))
  
      if res.std_err:
          with open(err_file_path, "wb") as err_file:
              err_file.write(res.std_err)
  
      return canonical_file(
          out_file_path,
          local=save_locally,
          diff_tool=diff_tool,
          diff_file_name=diff_file_name,
          diff_tool_timeout=diff_tool_timeout,
      )
  
file_path: catboost/library/python/testing/yatest_common/yatest/common/canonical.py
imports: import os
  import logging
  import shutil
  import tempfile
  import six
  from .None import process
  from .None import runtime
  from .None import path
label_desc: Use image node_id 7 for calling a global function with example usage: _canonical_execute(excutor, kwargs, file_name, save_locally, diff_tool, diff_file_name, diff_tool_timeout, data_transformer) and returns: canonical_file, x