code: def argv2line(argv):
      r
      escapedArgs = []
      for arg in argv:
          if ' ' in arg and '"' not in arg:
              arg = '"' + arg + '"'
          elif ' ' in arg and "'" not in arg:
              arg = "'" + arg + "'"
          elif ' ' in arg:
              arg = arg.replace('"', r'\"')
              arg = '"' + arg + '"'
          escapedArgs.append(arg)
      return ' '.join(escapedArgs)
docs: r"""Put together the given argument vector into a command line.
  
          "argv" is the argument vector to process.
  
      >>> from cmdln import argv2line
      >>> argv2line(['foo'])
      'foo'
      >>> argv2line(['foo', 'bar'])
      'foo bar'
      >>> argv2line(['foo', 'bar baz'])
      'foo "bar baz"'
      >>> argv2line(['foo"bar'])
      'foo"bar'
      >>> print(argv2line(['foo" bar']))
      'foo" bar'
      >>> print(argv2line(["foo' bar"]))
      "foo' bar"
      >>> argv2line(["foo'bar"])
      "foo'bar"