code: def pycmd2argv(cmd):
      r"""Take the path of a python command and return a list (argv-style).
  
      This only works on Python based command line programs and will find the
      location of the ``python`` executable using ``sys.executable`` to make
      sure the right version is used.
  
      For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe,
      .com or .bat, and [, cmd] otherwise.
  
      Parameters
      ----------
      cmd : string
        The path of the command.
  
      Returns
      -------
      argv-style list.
      """
      ext = os.path.splitext(cmd)[1]
      if ext in [".exe", ".com", ".bat"]:
          return [cmd]
      else:
          return [sys.executable, cmd]
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/process.py
imports: from __future__ import print_function
  import os
  import sys
  from ._process_common import getoutputerror, get_output_error_code, process_handler
  from .None import py3compat
label_desc: Use image node_id 3 for calling a global function with example usage: pycmd2argv(cmd) and returns: list, list