def METHOD_NAME(
    self, flow: dns.DNSFlow, msg: dns.Message
) -> layer.CommandGenerator[None]:
    flow.request = msg  # if already set, continue and query upstream again
    yield DnsRequestHook(flow)
    if flow.response:
        yield from self.handle_response(flow, flow.response)
    elif not self.context.server.address:
        yield from self.handle_error(
            flow, "No hook has set a response and there is no upstream server."
        )
    else:
        if not self.context.server.connected:
            err = yield commands.OpenConnection(self.context.server)
            if err:
                yield from self.handle_error(flow, str(err))
                # cannot recover from this
                return
        yield commands.SendData(self.context.server, flow.request.packed)