def quotecommand(cmd):
    """Build a command string suitable for os.popen* calls."""
    # The extra quotes are needed because popen* runs the command
    # through the current COMSPEC. cmd.exe suppress enclosing quotes.
    return '"' + cmd + '"'