class_docstr: Reads/writes `RecordIO` data format, supporting random access.
  
  Examples
  ---------
  >>> for i in range(5):
  ...     record.write_idx(i, 'record_%d'%i)
  >>> record.close()
  >>> record = mx.recordio.MXIndexedRecordIO('tmp.idx', 'tmp.rec', 'r')
  >>> record.read_idx(3)
  record_3
  
  Parameters
  ----------
  idx_path : str
      Path to the index file.
  uri : str
      Path to the record file. Only supports seekable file types.
  flag : str
      'w' for write or 'r' for read.
  key_type : type
      Data type for keys.
docstr: Inserts input record at given index.
  
  Examples
  ---------
  >>> for i in range(5):
  ...     record.write_idx(i, 'record_%d'%i)
  >>> record.close()
  
  Parameters
  ----------
  idx : int
      Index of a file.
  buf :
      Record to write.
docstr_tok: ["Inserts","input","record","at","given","index",".","Examples","--","--","--","--","-",">",">",">","for","i","in","range","(","5",")",":","...","record.write_idx","(","i",",","'record_","%","d","'","%","i",")",">",">",">","record.close","(",")","Parameters","--","--","--","--","--","idx",":","int","Index","of","a","file",".","buf",":","Record","to","write","."]
code: def write_idx(self, idx, buf):
      """Inserts input record at given index.
  
      Examples
      ---------
      >>> for i in range(5):
      ...     record.write_idx(i, 'record_%d'%i)
      >>> record.close()
  
      Parameters
      ----------
      idx : int
          Index of a file.
      buf :
          Record to write.
      """
      key = self.key_type(idx)
      pos = self.tell()
      self.write(buf)
      self.fidx.write(f"{str(key)}\t{pos}\n")
      self.idx[key] = pos
      self.keys.append(key)
  
imports: from collections import namedtuple
  from multiprocessing import current_process
  import ctypes
  import struct
  import numbers
  import numpy
  from .base import _LIB
  from .base import RecordIOHandle
  from .base import check_call
  from .base import c_str
label_desc: Use image node_id 8 for calling the MXIndexedRecordIO obj's underlying member method code with example usage: obj.write_idx(idx, buf) without return types