def argvquote(arg, force=False):
if not force and len(arg) != <NUM_LIT:0> and not any([c in arg for c in '<STR_LIT>']):<EOL><INDENT>return arg<EOL><DEDENT>else:<EOL><INDENT>n_backslashes = <NUM_LIT:0><EOL>cmdline = '<STR_LIT:">'<EOL>for c in arg:<EOL><INDENT>if c == "<STR_LIT:\\>":<EOL><INDENT>n_backslashes += <NUM_LIT:1><EOL>continue<EOL><DEDENT>if c == '<STR_LIT:">':<EOL><INDENT>cmdline += (n_backslashes * <NUM_LIT:2> + <NUM_LIT:1>) * '<STR_LIT:\\>'<EOL><DEDENT>else:<EOL><INDENT>cmdline += n_backslashes * '<STR_LIT:\\>'<EOL><DEDENT>n_backslashes = <NUM_LIT:0><EOL>cmdline += c<EOL><DEDENT>cmdline += + n_backslashes * <NUM_LIT:2> * '<STR_LIT:\\>' + '<STR_LIT:">'<EOL>return cmdline<EOL><DEDENT>
Returns an argument quoted in such a way that that CommandLineToArgvW
    on Windows will return the argument string unchanged.
    This is the same thing Popen does when supplied with an list of arguments.
    Arguments in a command line should be separated by spaces; this
    function does not add these spaces. This implementation follows the
    suggestions outlined here:
    https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/