@utils.allow_tableset_proxy
def order_by(self, key, reverse=False):
    if len(self._rows) == 0:
        return self._fork(self._rows)
    else:
        key_is_row_function = hasattr(key, '__call__')
        key_is_sequence = utils.issequence(key)

        def sort_key(data):
            row = data[1]

            if key_is_row_function:
                k = key(row)
            elif key_is_sequence:
                k = tuple(row[n] for n in key)
            else:
                k = row[key]

            if k is None:
                return utils.NullOrder()

            return k

        results = sorted(enumerate(self._rows), key=sort_key, reverse=reverse)

        indices, rows = zip(*results)

        if self._row_names is not None:
            row_names = [self._row_names[i] for i in indices]
        else:
            row_names = None

        return self._fork(rows, row_names=row_names)
REST BulkCalls Helper
dataset/ETHPy150Open wireservice/agate/agate/table/order_by.py/order_by--crossover with--dataset/ETHPy150Open plivo/plivohelper-python/plivohelper.py/REST.bulk_call