@defer.inlineCallbacks
    def on_GET(self, request, user_id, filter_id):
        target_user = UserID.from_string(user_id)
        requester = yield self.auth.get_user_by_req(request)

        if target_user != requester.user:
            raise AuthError(403, "Cannot get filters for other users")

        if not self.hs.is_mine(target_user):
            raise SynapseError(400, "Can only get filters for local users")

        try:
            filter_id = int(filter_id)
        except:
            raise SynapseError(400, "Invalid filter_id")

        try:
            filter = yield self.filtering.get_user_filter(
                user_localpart=target_user.localpart,
                filter_id=filter_id,
            )

            defer.returnValue((200, filter.get_filter_json()))
        except __HOLE__:
            raise SynapseError(400, "No such filter")
dataset/ETHPy150Open matrix-org/synapse/synapse/rest/client/v2_alpha/filter.py/GetFilterRestServlet.on_GET