def read(self, bytes):
    buffer = create_string_buffer(bytes)
count = c_int()
if d2xx.FT_Read(self.handle, buffer, bytes, byref(count)) == OK:
    return buffer.raw[:count.value]
raise D2XXException

def write(self, data):
    buffer = create_string_buffer(data)
count = c_int()
bytes = len(data)
if d2xx.FT_Write(self.handle, buffer, bytes, byref(count)) == OK:
    return count.value
raise D2XXException
Обертка библиотеки C в Python: C, Cython или ctypes?