def sort(self, key, reverse=False):
        row = self.GetGridCursorRow()
        col = self.GetGridCursorCol()
        curitem = self.table.items[row] # Remember where the cursor is now
        # Sort items
        def realkey(item):
            try:
                return key(item)
            except (KeyboardInterrupt, SystemExit):
                raise
            except Exception:
                return None
        try:
            self.table.items = ipipe.deque(sorted(self.table.items, key=realkey, reverse=reverse))
        except TypeError as exc:
            self.error_output("Exception encountered: %s" % exc)
            return
        # Find out where the object under the cursor went
        for (i, item) in enumerate(self.table.items):
            if item is curitem:
                self.SetGridCursor(i,col)
                self.MakeCellVisible(i,col)
                self.Refresh()
Actually perform the flagging of a comment from a request.
dataset/ETHPy150Open ipython/ipython-py3k/IPython/deathrow/igrid.py/IGridGrid.sort--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/comments/views/moderation.py/perform_flag