code: def sortBy(self, val=None):
          if val is not None:
              if _(val).isString():
                  return self._wrap(sorted(self.obj, key=lambda x,
                                    *args: x.get(val)))
              else:
                  return self._wrap(sorted(self.obj, key=val))
          else:
              return self._wrap(sorted(self.obj))