def xmlChromatogramFromCi(index, ci, compression='zlib'):
    """ #TODO: docstring
    :param index: #TODO: docstring
    :param ci: #TODO: docstring
    :param compression: #TODO: docstring

    :returns: #TODO: docstring
    """
    arrayLength = [array.size for array in viewvalues(ci.arrays)]
    if len(set(arrayLength)) != 1:
        raise Exception('Unequal size for different array in sai.arrays')
    else:
        arrayLength = arrayLength[0]

    chromatogramAttrib = {'index': str(index), 'id': ci.id,
                          'defaultArrayLength': str(arrayLength)}
    if 'dataProcessingRef' in ci.attrib:
        chromatogramAttrib.update({'dataProcessingRef': dataProcessingRef})

    xmlChromatogram = ETREE.Element('chromatogram', **chromatogramAttrib)
    maspy.xml.xmlAddParams(xmlChromatogram, ci.params)
    #TODO: add appropriate functions for precursor and product
    if ci.product is not None:
        raise NotImplementedError()
    if ci.precursor is not None:
        raise NotImplementedError()

    #Sort the array keys, that 'rt' is always the first, necessary for example
    #   for the software "SeeMS" to properly display chromatograms.
    arrayTypes = set(ci.arrayInfo)
    if 'rt' in arrayTypes:
        arrayTypes.remove('rt')
        arrayTypes = ['rt'] + list(arrayTypes)
    else:
        arrayTypes = list(arrayTypes)

    xmlChromatogram.append(xmlGenBinaryDataArrayList(ci.arrayInfo,
                                                     ci.arrays,
                                                     compression=compression,
                                                     arrayTypes=arrayTypes
                                                     )
                           )
    return xmlChromatogram