def get_ptr(data, offset=None, ptr_type=ctypes.c_void_p):
    """Returns a void pointer to the data"""
    ptr = ctypes.cast(ctypes.pointer(data), ctypes.c_void_p)

    if offset:
        ptr = ctypes.c_void_p(ptr.value + offset)

    if ptr_type != ctypes.c_void_p:
        ptr = ctypes.cast(ptr, ptr_type)

    return ptr