def loadNBTCompoundList(data, littleEndian=True, partNBT=False, count=None):
    """
    Loads a list of NBT Compound tags from a bunch of data.
    Uses sep to determine where the next Compound tag starts.
    :param data: str, the NBT to load from
    :param littleEndian: bool. Determines endianness
    :param partNBT: bool. If part of the data is NBT (begins with NBT), the function will return the list of compounds with the rest of the data that was not NBT
    :return: list of TAG_Compounds
    """
    def load(_data, _partNBT, _count):
        compound_list = []
        idx = 0
        count = 0
        while idx < len(_data) and (_count is None or count < _count):
            try:
                __data = nbt.load(buf=_data[idx:])
                idx += len(nbt.gunzip(__data.save()))
                count += 1
            except Exception as e:
                if _partNBT:
                    return compound_list, _data[idx:]
                msg1 = "PE support could not read compound list data:"
                msg2 = "Data dump:"
                msg3 = "Data length: %s"
                logger.error(msg1)
                logger.error(e)
                if len(_data[idx:]) > 80:
                    logger.error("Partial data dump:")
                    logger.error("%s [...] %s", repr(_data[:idx + 40]), repr(_data[-40:]))
                else:
                    logger.error(msg2)
                    logger.error(repr(_data[idx:]))
                logger.error(msg3, len(data))
                if DEBUG_PE:
                    try:
                        dump_line = len(open(dump_fName).read().splitlines()) + 1
                        dump_msg = "**********\n{m1}\n{e}\n{m2}\n{d}\n{m3} {l}".format(m1=msg1,
                                   e=e, m2=msg2, d=repr(_data[idx:]), m3=msg3, l=len(data))
                        msg_len = len(dump_msg.splitlines())
                        write_dump(dump_msg)
                        logger.warn("Error info and data dumped to %s at line %s (%s lines long)", dump_fName, dump_line, msg_len)
                    except Exception as _e:
                        logger.error("Could not dump PE debug info:")
                        logger.error(_e)
                raise e
            if DEBUG_PE == 2:
                write_dump("++++++++++\nloadNBTCompoundList_new parsed data:\n{d}\nis compound ? {ic}\n".format(d=__data, ic=__data.isCompound()))
            compound_list.append(__data)
        if _partNBT:
            return compound_list, _data[idx:]
        return compound_list

    if littleEndian:
        with nbt.littleEndianNBT():
            return load(data, partNBT, count)
    else:
        return load(data, partNBT, count)

    Loads a list of NBT Compound tags from a bunch of data.
    Uses sep to determine where the next Compound tag starts.
    :param data: str, the NBT to load from
    :param littleEndian: bool. Determines endianness
    :param partNBT: bool. If part of the data is NBT (begins with NBT), the function will return the list of compounds with the rest of the data that was not NBT
    :return: list of TAG_Compounds
    
pymclevel/leveldbpocket.py