code: def sort(self, field, direction="asc"):
          
          if not isinstance(field, basestring):
              raise ValueError("Field should be a string")
          if direction not in ["asc", "desc"]:
              raise ValueError("Sort direction should be `asc` or `desc`")
  
          self.sorts.append({field: direction})
docs: Adds sort criteria.