def shell_escape(s):
    """
    Use `shlex.quote` instead of this
    """
    import io
    fp = io.StringIO()
    sq = "'" + '"' + "'" + '"' + "'"
    dollar = "'" + "'" + '$' + "'" + "'"
    print("'", end='', file=fp)
    for c in s:
        if c == "'":
            print(sq, end='', file=fp)
        elif c == '$':
            print(dollar, end='', file=fp)
        else:
            print(c, end='', file=fp)
    print("'", end='', file=fp)
    return fp.getvalue()
