<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lookup(self, nick):
 """Looks for the most recent paste by a given nick. Returns the uid or None"""

        query = dict(nick=nick)
        order = [('time', pymongo.DESCENDING)]
        recs = self.db.pastes.find(query).sort(order).limit(1)
        try:
            return next(recs)['uid']
        except StopIteration:
            pass