<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_objects(self, query=None, limit=-1, offset=-1):
 """List of all objects in the database. Optinal parameter limit and offset for pagination. A dictionary of key,value-pairs can be given as addictional query condition for document properties. Parameters query : Dictionary Filter objects by property-value pairs defined by dictionary. limit : int Limit number of items in the result set offset : int Set offset in list (order as defined by object store) Returns ------- ObjectListing """

        result = []
        # Build the document query
        doc = {'active' : True}
        if not query is None:
            for key in query:
                doc[key] = query[key]
        # Iterate over all objects in the MongoDB collection and add them to
        # the result
        coll = self.collection.find(doc).sort([('timestamp', pymongo.DESCENDING)])
        count = 0
        for document in coll:
            # We are done if the limit is reached. Test first in case limit is
            # zero.
            if limit >= 0 and len(result) == limit:
                break
            if offset < 0 or count >= offset:
                result.append(self.from_dict(document))
            count += 1
        return ObjectListing(result, offset, limit, coll.count())