<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort_by(function):
 """ Sorts an incoming sequence by using the given `function` as key. [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``: [-3, 0, 4, 5, 8] And (as of ``0.2.3``) a shortcut for reversing the sort: ['s', 'S', 'f', 'f', 'd', 'a', 'a', 'a'] """

    f = partial(sorted, key=function)
    f.attrs = {'descending': _descending_sort_by(function)}
    return f