Break url parameters and turn into sort arguments

def build_sort(self, **kwargs):
        ''' Break url parameters and turn into sort arguments '''
        sort = []
        order = kwargs.get('order_by', None)
        if order:
            if type(order) is list:
                order = order[0]
            if order[:1] == '-':
                sort.append((order[1:], -1))
            else:
                sort.append((order, 1))
        return sort