code: def get_trace_entity(self):
          
          if not getattr(self._local, 'entities', None):
              return self.handle_context_missing()
  
          return self._local.entities[-1]
docs: Return the current trace entity(segment/subsegment). If there is none,
          it behaves based on pre-defined ``context_missing`` strategy.