<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(self, by, desc=False):
 """Sorts by given property or function, ascending or descending order. Parameters by : str or callable If string, property by which to sort. If callable, it should receive a GeoFeature a return a value by which to sort. desc : bool, optional Descending sort, default to False (ascending). """

        if callable(by):
            key = by
        else:
            def key(feature):
                return feature[by]

        sorted_features = sorted(list(self), reverse=desc, key=key)
        return self.__class__(sorted_features)