def quote(file):
    for c in file:
        if c not in _safechars:
            break
    else:
        if not file:
            return "''"
        return file
    # use single quotes, and put single quotes into double quotes
    # the string $'b is then quoted as '$'"'"'b'
    return "'" + file.replace("'", "'\"'\"'") + "'"
Return a shell-escaped version of the file string.
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/pipes.py/quote