'Transforms the value to a Geometry object.'

def to_python(self, value):

    if (value in self.empty_values):
        return None
    if (not isinstance(value, GEOSGeometry)):
        try:
            value = GEOSGeometry(value)
        except (GEOSException, ValueError, TypeError):
            raise forms.ValidationError(self.error_messages[u'invalid_geom'], code=u'invalid_geom')
    if (not value.srid):
        try:
            value.srid = self.widget.map_srid
        except AttributeError:
            if self.srid:
                value.srid = self.srid
    return value
