class_docstr: Buffer for index data
  
  Parameters
  ----------
  data : ndarray | None
      Buffer data.
class_docstr_tok: ["Buffer","for","index","data","Parameters","--","--","--","--","--","data",":","ndarray","|","None","Buffer","data","."]
code: 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")
      else:
          if convert:
              if data.dtype is not np.uint32:
                  data = data.astype(np.uint32)
          else:
              if data.dtype not in [np.uint32, np.uint16, np.uint8]:
                  raise TypeError(
                      "Invalid dtype for IndexBuffer: %r" % data.dtype
                  )
      return data
  
imports: import numpy
  from os import path
  from traceback import extract_stack, format_list
  import weakref
  from .globject import GLObject
  from ..util import logger
label_desc: Use image node_id 2 for calling the IndexBuffer obj's underlying member method code with example usage: obj._prepare_data(data, convert) and returns: data