code: def canonical_file(
      path,
      diff_tool=None,
      local=False,
      universal_lines=False,
      diff_file_name=None,
      diff_tool_timeout=None,
  ):
      """
      Create canonical file that can be returned from a test
      :param path: path to the file
      :param diff_tool: custom diff tool to use for comparison with the canonical one, if None - default will be used
      :param local: save file locally, otherwise move to sandbox
      :param universal_lines: normalize EOL
      :param diff_tool_timeout: timeout for running diff tool
      :return: object that can be canonized
      """
      abs_path = os.path.abspath(path)
      assert os.path.exists(
          abs_path
      ), "Canonical path {} does not exist".format(path)
      tempdir = tempfile.mkdtemp(
          prefix="canon_tmp", dir=runtime.build_path()
      )
      safe_path = os.path.join(tempdir, os.path.basename(abs_path))
      # if the created file is in output_path, we copy it, so that it will be available when the tests finishes
      _copy(path, safe_path, universal_lines=universal_lines)
      if diff_tool:
          if not isinstance(diff_tool, six.string_types):
              try:  # check if iterable
                  if not isinstance(diff_tool[0], six.string_types):
                      raise Exception(
                          "Invalid custom diff-tool: not cmd"
                      )
              except Exception:
                  raise Exception(
                      "Invalid custom diff-tool: not binary path"
                  )
      return runtime._get_ya_plugin_instance().file(
          safe_path,
          diff_tool=diff_tool,
          local=local,
          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 2 for calling a global function with example usage: canonical_file(path, diff_tool, local, universal_lines, diff_file_name, diff_tool_timeout) and returns: runtime