def finish(func, handler, args, kwargs):
    """
    Wrap the handler ``on_finish`` method to finish the Span for the
    given request, if available.
    """
    ret = func(*args, **kwargs)
    tracing = handler.settings.get('opentracing_tracing')
    if len(args) >= 1:
        chunk = args[0]
        biz_code = chunk.get('code') if isinstance(chunk, dict) else ''
    else:
        biz_code = ''
    tracing._finish_tracing(handler, biz_code=biz_code)
    return ret
