code: def end_subsegment(self, end_time=None):
          
          subsegment = self.get_trace_entity()
          if self._is_subsegment(subsegment):
              subsegment.close(end_time)
              self._local.entities.pop()
              return True
          else:
              log.warning("No subsegment to end.")
              return False
docs: End the current active segment. Return False if there is no
          subsegment to end.
  
          :param int end_time: epoch in seconds. If not specified the current
              system time will be used.