code: def split_command_line(command_line):
      """This splits a command line into a list of arguments. It splits arguments
      on spaces, but handles embedded quotes, doublequotes, and escaped
      characters. It's impossible to do this with a regular expression, so I
      wrote a little state machine to parse the command line."""
  
      arg_list = []
      arg = ""
  
      # Constants to name the states we can be in.
      state_basic = 0
      state_esc = 1
      state_singlequote = 2
      state_doublequote = 3
      # The state when consuming whitespace between commands.
      state_whitespace = 4
      state = state_basic
  
      for c in command_line:
          if state == state_basic or state == state_whitespace:
              if c == "\\":
                  # Escape the next character
                  state = state_esc
              elif c == r"'":
                  # Handle single quote
                  state = state_singlequote
              elif c == r'"':
                  # Handle double quote
                  state = state_doublequote
              elif c.isspace():
                  # Add arg to arg_list if we aren't in the middle of whitespace.
                  if state == state_whitespace:
                      # Do nothing.
                      None
                  else:
                      arg_list.append(arg)
                      arg = ""
                      state = state_whitespace
              else:
                  arg = arg + c
                  state = state_basic
          elif state == state_esc:
              arg = arg + c
              state = state_basic
          elif state == state_singlequote:
              if c == r"'":
                  state = state_basic
              else:
                  arg = arg + c
          elif state == state_doublequote:
              if c == r'"':
                  state = state_basic
              else:
                  arg = arg + c
  
      if arg != "":
          arg_list.append(arg)
      return arg_list
  
file_path: catboost/contrib/python/pexpect/py2/pexpect/utils.py
imports: import os
  import sys
  import stat
  import select
  import time
  import errno
label_desc: Use image node_id 3 for calling a global function with example usage: split_command_line(command_line) and returns: arg_list