code: def cmd2(command, shell=False, detatch=False, verbose=False, verbout=None):
      import shlex
      if isinstance(command, (list, tuple)):
          raise ValueError('command tuple not supported yet')
      args = shlex.split(command, posix=not WIN32)
      if verbose is True:
          verbose = 2
      if verbout is None:
          verbout = verbose >= 1
      if verbose >= 2:
          print('+=== START CMD2 ===')
          print('Command:')
          print(command)
          if verbout:
              print('----')
              print('Stdout:')
      proc = subprocess.Popen(args, stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT, shell=shell,
                              universal_newlines=True)
      if detatch:
          info = {'proc': proc}
      else:
          write_fn = sys.stdout.write
          flush_fn = sys.stdout.flush
          logged_out = []
          for line in _run_process(proc):
              line_ = line if six.PY2 else line
              if len(line_) > 0:
                  if verbout:
                      write_fn(line_)
                      flush_fn()
                  logged_out.append(line)
          try:
              from utool import util_str
              out = ''.join(logged_out)
          except UnicodeDecodeError:
              from utool import util_str
              logged_out = util_str.ensure_unicode_strlist(logged_out)
              out = ''.join(logged_out)
          (out_, err) = proc.communicate()
          ret = proc.wait()
          info = {
              'out': out,
              'err': err,
              'ret': ret,
          }
      if verbose >= 2:
          print('L___ END CMD2 ___')
      return info