def _context_wrapped(func):
        """
        Wrapping boto calls with dummy segment. This is because botocore
        has two dependencies (requests and httplib) that might be
        monkey-patched in user code to capture subsegments. The wrapper
        makes sure there is always a non-sampled segment present when
        the connector makes an  AWS API call using botocore.
        This context wrapper doesn't work with asyncio based context
        as event loop is not thread-safe.
        """
        def wrapper(self, *args, **kargs):
            if type(self.context).__name__ == 'AsyncContext':
                return func(self, *args, **kargs)
            segment = DummySegment()
            self.context.set_trace_entity(segment)
            result = func(self, *args, **kargs)
            self.context.clear_trace_entities()
            return result

        return wrapper
Wrapping boto calls with dummy segment. This is because botocore
        has two dependencies (requests and httplib) that might be
        monkey-patched in user code to capture subsegments. The wrapper
        makes sure there is always a non-sampled segment present when
        the connector makes an  AWS API call using botocore.
        This context wrapper doesn't work with asyncio based context
        as event loop is not thread-safe.