def escape_grouped_arguments(s):
    'Prepares a string for the shell (on Windows too!)\n\n    Only for use on grouped arguments (passed as a string to Popen)\n    '
    if (s is None):
        return None
    if (os.name == 'nt'):
        s = '{}'.format(s.replace('\\', '\\\\'))
    return (('"' + s.replace("'", "'\\''")) + '"')
Prepares a string for the shell (on Windows too!)

Only for use on grouped arguments (passed as a string to Popen)
def escape_grouped_arguments(s):
    'Prepares a string for the shell (on Windows too!)\n\n    Only for use on grouped arguments (passed as a string to Popen)\n    '
    if (s is None):
        return None
    if (os.name == 'nt'):
        s = '{}'.format(s.replace('\\', '\\\\'))
    return (('"' + s.replace("'", "'\\")) + '"')