static PyObject *Triton_setMemValue(PyObject *self, PyObject *args)
{
  PyObject  *addr;
  PyObject  *value;
  PyObject  *writeSize;
  uint128   va; // value
  uint64    ad; // address
  uint64    ws; // write size

  /* Extract arguments */
  PyArg_ParseTuple(args, "O|O|O", &addr, &writeSize, &value);

  if (!PyLong_Check(addr) && !PyInt_Check(addr))
    return PyErr_Format(PyExc_TypeError, "setMemValue(): expected an address (integer) as first argument");

  if (!PyLong_Check(writeSize) && !PyInt_Check(writeSize))
    return PyErr_Format(PyExc_TypeError, "setMemValue(): expected an integer as second argument");

  if (!PyLong_Check(value) && !PyInt_Check(value))
    return PyErr_Format(PyExc_TypeError, "setMemValue(): expected an integer as third argument");

  ad = PyLong_AsLong(addr);
  ws = PyLong_AsLong(writeSize);

  if (ws != DQWORD_SIZE && ws != QWORD_SIZE && ws != DWORD_SIZE && ws != WORD_SIZE && ws != BYTE_SIZE)
    return PyErr_Format(PyExc_TypeError, "setMemValue(): The writeSize argument must be: DQWORD, QWORD, DWORD, WORD or BYTE");

  if (PIN_CheckWriteAccess(reinterpret_cast<void*>(ad)) == false)
    return PyErr_Format(PyExc_TypeError, "setMemValue(): Can not write into the targeted address memory");

  va = PyLongObjectToUint128(value);
  ap.setMemValue(ad, ws, va);

  return Py_None;
}