def decode_hook(obj): if obj.get('__type__', None) == '__polygon__': return Polygon.from_ewkt(obj['ewkt']) return obj