code: def sorts_query(sortables):
          stmts = []
          for sortable in sortables:
              if sortable.desc:
                  stmts.append('{} DESC'.format(sortable.field))
              else:
                  stmts.append('{} ASC'.format(sortable.field))
          return ' ORDER BY {}'.format(', '.join(stmts))