<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def writeBinaryItemContainer(filelike, binaryItemContainer, compress=True):
 """Serializes the binaryItems contained in binaryItemContainer and writes them into a zipfile archive. Examples of binaryItem classes are :class:`maspy.core.Ci` and :class:`maspy.core.Sai`. A binaryItem class has to define the function ``_reprJSON()`` which returns a JSON formated string representation of the class instance. In addition it has to contain an attribute ``.arrays``, a dictionary which values are ``numpy.array``, that are serialized to bytes and written to the ``binarydata`` file of the zip archive. See :func:`_dumpArrayDictToFile()` The JSON formated string representation of the binaryItems, together with the metadata, necessary to restore serialized numpy arrays, is written to the ``metadata`` file of the archive in this form: Use the method :func:`loadBinaryItemContainer()` to restore a binaryItemContainer from a zipfile. :param filelike: path to a file (str) or a file-like object :param binaryItemContainer: a dictionary containing binaryItems :param compress: bool, True to use zip file compression """

    allMetadata = dict()
    binarydatafile = io.BytesIO()
    #Note: It would be possible to sort the items here
    for index, binaryItem in enumerate(viewvalues(binaryItemContainer)):
        metadataList = _dumpArrayDictToFile(binarydatafile, binaryItem.arrays)
        allMetadata[index] = [binaryItem._reprJSON(), metadataList]

    #TODO: Is seek here still necessary?
    binarydatafile.seek(0)

    zipcomp = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP_STORED
    with zipfile.ZipFile(filelike, 'w', allowZip64=True) as containerFile:
        containerFile.writestr('metadata',
                               json.dumps(allMetadata, cls=MaspyJsonEncoder),
                               zipcomp
                               )
        containerFile.writestr('binarydata', binarydatafile.getvalue(), zipcomp)