def METHOD_NAME(self):
    """Finishes the current span in the context and restores the context from before the
    span was started.
    """
    span = self.current_span()
    if not span:
        _logger.warning("No active span, cannot do end_span.")
        return
    span.finish()
    # pylint: disable=protected-access
    context.detach(span._self_token)
    # Also reset the OC execution_context, equivalent to
    # https://github.com/census-instrumentation/opencensus-python/blob/2e08df591b507612b3968be8c2538dedbf8fab37/opencensus/trace/tracers/context_tracer.py#L114-L117
    execution_context.set_current_span(self.current_span())