code: def sort_by(function):
      
      f = partial(sorted, key=function)
      f.attrs = {'descending': _descending_sort_by(function)}
      return f
docs: Sorts an incoming sequence by using the given `function` as key.
  
      >>> range(10) > sort_by(-X)
      [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
  
      Supports automatic data-structure creation::
  
          users > sort_by([X.last_name, X.first_name])
  
      There is also a shortcut for ``sort_by(X)`` called ``sort``:
  
      >>> [4, 5, 8, -3, 0] > sort
      [-3, 0, 4, 5, 8]
  
      And (as of ``0.2.3``) a shortcut for reversing the sort:
  
      >>> 'asdfaSfa' > sort_by(X.lower()).descending
      ['s', 'S', 'f', 'f', 'd', 'a', 'a', 'a']