human
I wrote the below code

    @defer.inlineCallbacks
    def wrapped_request_handler(self, request):
        global _next_request_id
        request_id = ('%s-%s' % (request.method, _next_request_id))
        _next_request_id += 1
        with LoggingContext(request_id) as request_context:
            with Measure(self.clock, 'wrapped_request_handler'):
                request_metrics = RequestMetrics()
                request_metrics.start(self.clock, name=self.__class__.__name__)
                request_context.request = request_id
                with request.processing():
                    try:
                        with PreserveLoggingContext(request_context):
                            if include_metrics:
                                (yield request_handler(self, request, request_metrics))
                            else:
                                (yield request_handler(self, request))
                    except CodeMessageException as e:
                        code = e.code
                        if isinstance(e, SynapseError):
                            logger.info('%s    SynapseError:    %s    -    %s', request, code, e.msg)
                        else:
                            logger.exception(e)
                        outgoing_responses_counter.inc(request.method, str(code))
                        respond_with_json(request, code, cs_exception(e), send_cors=True, pretty_print=_request_user_agent_is_curl(request), version_string=self.version_string)
                    except:
                        logger.exception('Failed    handle    request    %s.%s    on    %r:    %r', request_handler.__module__, request_handler.__name__, self, request)
                        respond_with_json(request, 500, {'error': 'Internal    server    error', 'errcode': Codes.UNKNOWN}, send_cors=True)
                    finally:
                        try:
                            request_metrics.stop(self.clock, request)
                        except Exception as e:
                            logger.warn('Failed   ...

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def wrap_request_handler(request_handler, include_metrics=False):