code: def _writeIndexListElement(xmlWriter, elementName, indexList):
      
      if indexList:
          xmlIndex = xmlWriter.element('index', {'name': elementName})
          xmlIndex.__enter__()
          xmlWriter.write('\n')
          for offset, indexId in indexList:
              offsetElement = ETREE.Element('offset', {'idRef': indexId})
              offsetElement.text = str(offset)
              xmlWriter.write(offsetElement, pretty_print=True)
          xmlIndex.__exit__(None, None, None)
          xmlWriter.write('\n')
docs: #TODO: docstring
  
      :param xmlWriter: #TODO: docstring
      :param elementName: #TODO: docstring
      :param indexList: #TODO: docstring