<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def groupby(self, by):
 # type: (Union[str, Callable[[GeoFeature], str]]) -> _CollectionGroupBy """Groups collection using a value of a property. Parameters by : str or callable If string, name of the property by which to group. If callable, should receive a GeoFeature and return the category. Returns ------- _CollectionGroupBy """

        results = OrderedDict()  # type: OrderedDict[str, list]
        for feature in self:
            if callable(by):
                value = by(feature)
            else:
                value = feature[by]

            results.setdefault(value, []).append(feature)

        if hasattr(self, "_schema"):
            # I am doing this to trick mypy, is there a better way?
            # calling self._schema generates a mypy problem
            schema = getattr(self, "_schema")

        return _CollectionGroupBy(results, schema=schema)