(s)
return '"' + s.replace('"', '"\'"\'"') + '"'
Escape a string with double quotes in order to be parsed as a single element by shlex

    Parameters
    ----------
    s : str
        The string to quote

    Returns
    -------
    str
       The quoted string
Escape a string with double quotes in order to be parsed as a single element by shlex
Escape a string with double quotes in order to be parsed as a single element by shlex
def double_quote(s):
    """Escape a string with double quotes in order to be parsed as a single element by shlex

    Parameters
    ----------
    s : str
        The string to quote

    Returns
    -------
    str
       The quoted string
    """
    if not s:
        return '""'
    if find_unsafe(s) is None:
        return s

    # use double quotes, and put double quotes into single quotes
    # the string $"b is then quoted as "$"'"'"b"
    return '"' + s.replace('"', '"\'"\'"') + '"'
def double_quote ( s ) : if not s : return '""' if find_unsafe ( s ) is None : return s # use double quotes, and put double quotes into single quotes # the string $"b is then quoted as "$"'"'"b" return '"' + s . replace ( '"' , '"\'"\'"' ) + '"'