def sort(self, by, desc=False):
        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)