docs: def start_span(request_headers=None):
      """Collects incoming B3 headers and sets up values for this request as needed.
      The collected/computed values are stored on the application context g using the defined http header names as keys.
      :param request_headers: Incoming request headers can be passed explicitly.
      If not passed, Flask request.headers will be used. This enables you to pass this function to Flask.before_request().
      """
      global debug
      try:
          headers = request_headers if request_headers else request.headers
      except RuntimeError:
          # We're probably working outside the Application Context at this point, likely on startup:
          # https://stackoverflow.com/questions/31444036/runtimeerror-working-outside-of-application-context
          # We return a dict of empty values so the expected keys are present.
          headers = {}
  
      trace_id = headers.get(b3_trace_id)
      parent_span_id = headers.get(b3_parent_span_id)
      span_id = headers.get(b3_span_id)
      sampled = headers.get(b3_sampled)
      flags = headers.get(b3_flags)
      root_span = not trace_id
  
      # Collect (or generate) a trace ID
      setattr(g, b3_trace_id, trace_id or _generate_identifier())
  
      # Parent span, if present
      setattr(g, b3_parent_span_id, parent_span_id)
  
      # Collect (or set) the span ID
      setattr(g, b3_span_id, span_id or g.get(b3_trace_id))
  
      # Collect the "sampled" flag, if present
      # We'll propagate the sampled value unchanged if it's set.
      # We're not currently recording traces to Zipkin, so if it's present, follow the standard and propagate it,
      # otherwise it's better to leave it out, rather than make it "0".
      # This allows downstream services to make a decision if they need to.
      setattr(g, b3_sampled, sampled)
  
      # Set or update the debug setting
      # We'll set it to "1" if debug=True, otherwise we'll propagate it if present.
      setattr(g, b3_flags, "1" if debug else flags)
  
      _info("Server receive. Starting span" if trace_id else "Root span")
      _log.debug("Resolved B3 values: {values}".format(values=values()))