code: def cint32_array_to_numpy(cptr, length):
      
      if isinstance(cptr, ctypes.POINTER(ctypes.c_int32)):
          return np.fromiter(cptr, dtype=np.int32, count=length)
      else:
          raise RuntimeError('Expected int pointer')
docs: Convert a ctypes int pointer array to a numpy array.