Imports binaryItems from a zipfile generated by
    :func:`writeBinaryItemContainer`.

    :param zipfile: can be either a path to a file (a string) or a file-like
        object
    :param jsonHook: a custom decoding function for JSON formated strings of the
        binaryItems stored in the zipfile.

    :returns: a dictionary containing binaryItems
        ``{binaryItem.id: binaryItem, ... }``

def loadBinaryItemContainer(zippedfile, jsonHook):
    """Imports binaryItems from a zipfile generated by
    :func:`writeBinaryItemContainer`.

    :param zipfile: can be either a path to a file (a string) or a file-like
        object
    :param jsonHook: a custom decoding function for JSON formated strings of the
        binaryItems stored in the zipfile.

    :returns: a dictionary containing binaryItems
        ``{binaryItem.id: binaryItem, ... }``
    """
    binaryItemContainer = dict()
    with zipfile.ZipFile(zippedfile, 'r') as containerZip:
        #Convert the zipfile data into a str object, necessary since
        #containerZip.read() returns a bytes object.
        metadataText = io.TextIOWrapper(containerZip.open('metadata'),
                                        encoding='utf-8'
                                        ).read()
        allMetadata = json.loads(metadataText, object_hook=jsonHook)
        metadataIndex = [str(_) for _ in sorted([int(i) for i in
                                                 viewkeys(allMetadata)
                                                 ])
                         ]
        binarydataFile = containerZip.open('binarydata')
        for index in metadataIndex:
            binaryItem = allMetadata[index][0]
            for binaryMetadata in allMetadata[index][1]:
                arrayKey = binaryMetadata['arrayKey']
                rawdata = binarydataFile.read(binaryMetadata['end'] -
                                              binaryMetadata['start']
                                              )
                array = _arrayFromBytes(rawdata, binaryMetadata)
                binaryItem.arrays[arrayKey] = array
            binaryItemContainer[binaryItem.id] = binaryItem
    return binaryItemContainer