code: def from_header(self, header):
          
          if header is None:
              return SpanContext()
  
          try:
              match = re.search(_TRACE_CONTEXT_HEADER_RE, header)
          except TypeError:
              logging.warning(
                  'Header should be str, got {}. Cannot parse the header.'
                  .format(header.__class__.__name__))
              raise
  
          if match:
              trace_id = match.group(1)
              span_id = match.group(3)
              trace_options = match.group(5)
  
              if trace_options is None:
                  trace_options = 1
  
              span_context = SpanContext(
                  trace_id=trace_id,
                  span_id=span_id,
                  trace_options=TraceOptions(trace_options),
                  from_header=True)
              return span_context
          else:
              logging.warning(
                  'Cannot parse the header {}, generate a new context instead.'
                  .format(header))
              return SpanContext()
docs: Generate a SpanContext object using the trace context header.
          The value of enabled parsed from header is int. Need to convert to
          bool.
  
          :type header: str
          :param header: Trace context header which was extracted from the HTTP
                         request headers.
  
          :rtype: :class:`~opencensus.trace.span_context.SpanContext`
          :returns: SpanContext generated from the trace context header.