code: def _refresh_context(self):
          
          header_str = os.getenv(LAMBDA_TRACE_HEADER_KEY)
          trace_header = TraceHeader.from_header_str(header_str)
          if not global_sdk_config.sdk_enabled():
              trace_header._sampled = False
  
          segment = getattr(self._local, 'segment', None)
  
          if segment:
              # Ensure customers don't have leaked subsegments across invocations
              if not trace_header.root or trace_header.root == segment.trace_id:
                  return
              else:
                  self._initialize_context(trace_header)
          else:
              self._initialize_context(trace_header)
docs: Get current facade segment. To prevent resource leaking in Lambda worker,
          every time there is segment present, we compare its trace id to current
          environment variables. If it is different we create a new facade segment
          and clean up subsegments stored.