def _prepare_data(self, data, convert=False):
    if isinstance(data, list):
        data = np.array(data, dtype=np.uint32)
    if (not isinstance(data, np.ndarray)):
        raise ValueError(('Data must be a ndarray (got %s)' % type(data)))
    if (not data.dtype.isbuiltin):
        raise TypeError('Element buffer dtype cannot be structured')
    elif convert:
        if (data.dtype is not np.uint32):
            data = data.astype(np.uint32)
    elif (data.dtype not in [np.uint32, np.uint16, np.uint8]):
        raise TypeError(('Invalid dtype for IndexBuffer: %r' % data.dtype))
    return data
def _prepare_data(self, data, convert=False):
    if isinstance(data, list):
        data = np.array(data, dtype=np.uint32)
    if (not isinstance(data, np.ndarray)):
        raise ValueError(('Data must be a ndarray (got %s)' % type(data)))
    if (not data.dtype.isbuiltin):
        raise TypeError('Element buffer dtype cannot be structured')
    elif convert:
        if (data.dtype is not np.uint32):
            data = data.astype(np.uint32)
    elif (data.dtype not in [np.uint32, np.uint16, np.uint8]):
        raise TypeError(('Invalid dtype for IndexBuffer: %r' % data.dtype))
    return data