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))
docs: Turn the Sortables into a SQL ORDER BY query