def to_python(self, value):
        if value in self.empty_values:
            return None
        # Work with a single GeoJSON geometry or a Feature. Avoid parsing
        # overhead unless we have a true "Feature".
        if '"Feature",' in value:
            d = json.loads(value)
            value = json.dumps(d.get('geometry'))
        # Handle a comma delimited extent.
        elif list(value).count(',') == 3:
            value = Envelope(value.split(',')).polygon.ExportToWkt()
        try:
            geom = gdal.OGRGeometry(value)
        except (gdal.OGRException, TypeError, ValueError):
            raise forms.ValidationError(self.error_messages['invalid_geom'])
        if not geom.srs:
            geom.srid = self.srid or self.widget.map_srid
        return geom
dataset/ETHPy150Open bkg/django-spillway/spillway/forms/fields.py/OGRGeometryField.to_python/original