def read(self, request, *args, **kwargs):
        if not self.has_model():
            return rc.NOT_IMPLEMENTED

        pkfield = kwargs.get(self.model._meta.pk.name)

        if pkfield:
            try:
                obj = self.model.objects.get(pk=pkfield)
                if not self.check_instance_permission(request, obj, 'r'):
                    return rc.FORBIDDEN
                else:
                    return obj
            except __HOLE__:
                return rc.NOT_FOUND
            # should never happen, since we're using a PK
            except MultipleObjectsReturned:
                return rc.BAD_REQUEST
        else:
            query = self.get_filter_query(request.GET)
            return self.model.filter_by_request(request, self.model.objects.filter(query))
dataset/ETHPy150Open treeio/treeio/treeio/core/api/handlers.py/ObjectHandler.read