def METHOD_NAME(pgconn, scs):
    esc = pq.Escaping(pgconn)
    res = pgconn.exec_(f"set standard_conforming_strings to {scs}".encode("ascii"))
    assert res.status == pq.ExecStatus.COMMAND_OK
    special = {b"'": b"''", b"\\": b"\\" if scs == "on" else b"\\\\"}
    for c in range(1, 128):
        data = bytes([c])
        rv = esc.escape_string(data)
        exp = special.get(data) or b"%s" % data
        assert rv == exp