prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ddtrace not working with new aiobotocore library
  
  ### Which version of dd-trace-py are you using?
  0.34.0
  
  ### Which version of the libraries are you using?
  
  ```
  aiobotocore==0.12.0
  aiohttp==3.6.2
  aioitertools==0.5.1
  async-timeout==3.0.1
  attrs==19.3.0
  botocore==1.15.15
  chardet==3.0.4
  ddtrace==0.34.0
  docutils==0.15.2
  idna==2.9
  jmespath==0.9.5
  msgpack==1.0.0
  multidict==4.7.5
  python-dateutil==2.8.1
  six==1.14.0
  urllib3==1.25.8
  wrapt==1.12.0
  yarl==1.4.2
  ```
  
  ### How can we reproduce your problem?
  ```python
      from ddtrace import patch
  
      patch(aiobotocore=True)
  ```
  
  ### What is the result that you get?
  ```
  ImportError: cannot import name 'ClientResponseContentProxy' from 'aiobotocore.endpoint' 
      raise PatchException('integration not available')
  ddtrace.monkey.PatchException: integration not available
  ```
  
  ### What is result that you expected?
  Successfully patched `aiobotocore` library
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ddtrace/contrib/aiobotocore/patch.py`
  Content:
  ```
  1 import asyncio
  2 from ddtrace.vendor import wrapt
  3 from ddtrace import config
  4 import aiobotocore.client
  5 
  6 from aiobotocore.endpoint import ClientResponseContentProxy
  7 
  8 from ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY
  9 from ...pin import Pin
  10 from ...ext import SpanTypes, http, aws
  11 from ...compat import PYTHON_VERSION_INFO
  12 from ...utils.formats import deep_getattr
  13 from ...utils.wrappers import unwrap
  14 
  15 
  16 ARGS_NAME = ('action', 'params', 'path', 'verb')
  17 TRACED_ARGS = ['params', 'path', 'verb']
  18 
  19 
  20 def patch():
  21     if getattr(aiobotocore.client, '_datadog_patch', False):
  22         return
  23     setattr(aiobotocore.client, '_datadog_patch', True)
  24 
  25     wrapt.wrap_function_wrapper('aiobotocore.client', 'AioBaseClient._make_api_call', _wrapped_api_call)
  26     Pin(service='aws', app='aws').onto(aiobotocore.client.AioBaseClient)
  27 
  28 
  29 def unpatch():
  30     if getattr(aiobotocore.client, '_datadog_patch', False):
  31         setattr(aiobotocore.client, '_datadog_patch', False)
  32         unwrap(aiobotocore.client.AioBaseClient, '_make_api_call')
  33 
  34 
  35 class WrappedClientResponseContentProxy(wrapt.ObjectProxy):
  36     def __init__(self, body, pin, parent_span):
  37         super(WrappedClientResponseContentProxy, self).__init__(body)
  38         self._self_pin = pin
  39         self._self_parent_span = parent_span
  40 
  41     @asyncio.coroutine
  42     def read(self, *args, **kwargs):
  43         # async read that must be child of the parent span operation
  44         operation_name = '{}.read'.format(self._self_parent_span.name)
  45 
  46         with self._self_pin.tracer.start_span(operation_name, child_of=self._self_parent_span) as span:
  47             # inherit parent attributes
  48             span.resource = self._self_parent_span.resource
  49             span.span_type = self._self_parent_span.span_type
  50             span.meta = dict(self._self_parent_span.meta)
  51             span.metrics = dict(self._self_parent_span.metrics)
  52 
  53             result = yield from self.__wrapped__.read(*args, **kwargs)
  54             span.set_tag('Length', len(result))
  55 
  56         return result
  57 
  58     # wrapt doesn't proxy `async with` context managers
  59     if PYTHON_VERSION_INFO >= (3, 5, 0):
  60         @asyncio.coroutine
  61         def __aenter__(self):
  62             # call the wrapped method but return the object proxy
  63             yield from self.__wrapped__.__aenter__()
  64             return self
  65 
  66         @asyncio.coroutine
  67         def __aexit__(self, *args, **kwargs):
  68             response = yield from self.__wrapped__.__aexit__(*args, **kwargs)
  69             return response
  70 
  71 
  72 @asyncio.coroutine
  73 def _wrapped_api_call(original_func, instance, args, kwargs):
  74     pin = Pin.get_from(instance)
  75     if not pin or not pin.enabled():
  76         result = yield from original_func(*args, **kwargs)
  77         return result
  78 
  79     endpoint_name = deep_getattr(instance, '_endpoint._endpoint_prefix')
  80 
  81     with pin.tracer.trace('{}.command'.format(endpoint_name),
  82                           service='{}.{}'.format(pin.service, endpoint_name),
  83                           span_type=SpanTypes.HTTP) as span:
  84         span.set_tag(SPAN_MEASURED_KEY)
  85 
  86         if len(args) > 0:
  87             operation = args[0]
  88             span.resource = '{}.{}'.format(endpoint_name, operation.lower())
  89         else:
  90             operation = None
  91             span.resource = endpoint_name
  92 
  93         aws.add_span_arg_tags(span, endpoint_name, args, ARGS_NAME, TRACED_ARGS)
  94 
  95         region_name = deep_getattr(instance, 'meta.region_name')
  96 
  97         meta = {
  98             'aws.agent': 'aiobotocore',
  99             'aws.operation': operation,
  100             'aws.region': region_name,
  101         }
  102         span.set_tags(meta)
  103 
  104         result = yield from original_func(*args, **kwargs)
  105 
  106         body = result.get('Body')
  107         if isinstance(body, ClientResponseContentProxy):
  108             result['Body'] = WrappedClientResponseContentProxy(body, pin, span)
  109 
  110         response_meta = result['ResponseMetadata']
  111         response_headers = response_meta['HTTPHeaders']
  112 
  113         span.set_tag(http.STATUS_CODE, response_meta['HTTPStatusCode'])
  114         span.set_tag('retry_attempts', response_meta['RetryAttempts'])
  115 
  116         request_id = response_meta.get('RequestId')
  117         if request_id:
  118             span.set_tag('aws.requestid', request_id)
  119 
  120         request_id2 = response_headers.get('x-amz-id-2')
  121         if request_id2:
  122             span.set_tag('aws.requestid2', request_id2)
  123 
  124         # set analytics sample rate
  125         span.set_tag(
  126             ANALYTICS_SAMPLE_RATE_KEY,
  127             config.aiobotocore.get_analytics_sample_rate()
  128         )
  129 
  130         return result
  131
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ddtrace/contrib/aiobotocore/patch.py b/ddtrace/contrib/aiobotocore/patch.py
  --- a/ddtrace/contrib/aiobotocore/patch.py
  +++ b/ddtrace/contrib/aiobotocore/patch.py
  @@ -3,7 +3,11 @@
   from ddtrace import config
   import aiobotocore.client
   
  -from aiobotocore.endpoint import ClientResponseContentProxy
  +try:
  +    from aiobotocore.endpoint import ClientResponseContentProxy
  +except ImportError:
  +    # aiobotocore>=0.11.0
  +    from aiobotocore._endpoint_helpers import ClientResponseContentProxy
   
   from ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY
   from ...pin import Pin
  
verification_info: {"golden_diff": "diff --git a/ddtrace/contrib/aiobotocore/patch.py b/ddtrace/contrib/aiobotocore/patch.py\n--- a/ddtrace/contrib/aiobotocore/patch.py\n+++ b/ddtrace/contrib/aiobotocore/patch.py\n@@ -3,7 +3,11 @@\n from ddtrace import config\n import aiobotocore.client\n \n-from aiobotocore.endpoint import ClientResponseContentProxy\n+try:\n+    from aiobotocore.endpoint import ClientResponseContentProxy\n+except ImportError:\n+    # aiobotocore>=0.11.0\n+    from aiobotocore._endpoint_helpers import ClientResponseContentProxy\n \n from ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY\n from ...pin import Pin\n", "issue": "ddtrace not working with new aiobotocore library\n\r\n### Which version of dd-trace-py are you using?\r\n0.34.0\r\n\r\n### Which version of the libraries are you using?\r\n\r\n```\r\naiobotocore==0.12.0\r\naiohttp==3.6.2\r\naioitertools==0.5.1\r\nasync-timeout==3.0.1\r\nattrs==19.3.0\r\nbotocore==1.15.15\r\nchardet==3.0.4\r\nddtrace==0.34.0\r\ndocutils==0.15.2\r\nidna==2.9\r\njmespath==0.9.5\r\nmsgpack==1.0.0\r\nmultidict==4.7.5\r\npython-dateutil==2.8.1\r\nsix==1.14.0\r\nurllib3==1.25.8\r\nwrapt==1.12.0\r\nyarl==1.4.2\r\n```\r\n\r\n### How can we reproduce your problem?\r\n```python\r\n    from ddtrace import patch\r\n\r\n    patch(aiobotocore=True)\r\n```\r\n\r\n### What is the result that you get?\r\n```\r\nImportError: cannot import name 'ClientResponseContentProxy' from 'aiobotocore.endpoint' \r\n    raise PatchException('integration not available')\r\nddtrace.monkey.PatchException: integration not available\r\n```\r\n\r\n### What is result that you expected?\r\nSuccessfully patched `aiobotocore` library\n", "before_files": [{"content": "import asyncio\nfrom ddtrace.vendor import wrapt\nfrom ddtrace import config\nimport aiobotocore.client\n\nfrom aiobotocore.endpoint import ClientResponseContentProxy\n\nfrom ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY\nfrom ...pin import Pin\nfrom ...ext import SpanTypes, http, aws\nfrom ...compat import PYTHON_VERSION_INFO\nfrom ...utils.formats import deep_getattr\nfrom ...utils.wrappers import unwrap\n\n\nARGS_NAME = ('action', 'params', 'path', 'verb')\nTRACED_ARGS = ['params', 'path', 'verb']\n\n\ndef patch():\n    if getattr(aiobotocore.client, '_datadog_patch', False):\n        return\n    setattr(aiobotocore.client, '_datadog_patch', True)\n\n    wrapt.wrap_function_wrapper('aiobotocore.client', 'AioBaseClient._make_api_call', _wrapped_api_call)\n    Pin(service='aws', app='aws').onto(aiobotocore.client.AioBaseClient)\n\n\ndef unpatch():\n    if getattr(aiobotocore.client, '_datadog_patch', False):\n        setattr(aiobotocore.client, '_datadog_patch', False)\n        unwrap(aiobotocore.client.AioBaseClient, '_make_api_call')\n\n\nclass WrappedClientResponseContentProxy(wrapt.ObjectProxy):\n    def __init__(self, body, pin, parent_span):\n        super(WrappedClientResponseContentProxy, self).__init__(body)\n        self._self_pin = pin\n        self._self_parent_span = parent_span\n\n    @asyncio.coroutine\n    def read(self, *args, **kwargs):\n        # async read that must be child of the parent span operation\n        operation_name = '{}.read'.format(self._self_parent_span.name)\n\n        with self._self_pin.tracer.start_span(operation_name, child_of=self._self_parent_span) as span:\n            # inherit parent attributes\n            span.resource = self._self_parent_span.resource\n            span.span_type = self._self_parent_span.span_type\n            span.meta = dict(self._self_parent_span.meta)\n            span.metrics = dict(self._self_parent_span.metrics)\n\n            result = yield from self.__wrapped__.read(*args, **kwargs)\n            span.set_tag('Length', len(result))\n\n        return result\n\n    # wrapt doesn't proxy `async with` context managers\n    if PYTHON_VERSION_INFO >= (3, 5, 0):\n        @asyncio.coroutine\n        def __aenter__(self):\n            # call the wrapped method but return the object proxy\n            yield from self.__wrapped__.__aenter__()\n            return self\n\n        @asyncio.coroutine\n        def __aexit__(self, *args, **kwargs):\n            response = yield from self.__wrapped__.__aexit__(*args, **kwargs)\n            return response\n\n\n@asyncio.coroutine\ndef _wrapped_api_call(original_func, instance, args, kwargs):\n    pin = Pin.get_from(instance)\n    if not pin or not pin.enabled():\n        result = yield from original_func(*args, **kwargs)\n        return result\n\n    endpoint_name = deep_getattr(instance, '_endpoint._endpoint_prefix')\n\n    with pin.tracer.trace('{}.command'.format(endpoint_name),\n                          service='{}.{}'.format(pin.service, endpoint_name),\n                          span_type=SpanTypes.HTTP) as span:\n        span.set_tag(SPAN_MEASURED_KEY)\n\n        if len(args) > 0:\n            operation = args[0]\n            span.resource = '{}.{}'.format(endpoint_name, operation.lower())\n        else:\n            operation = None\n            span.resource = endpoint_name\n\n        aws.add_span_arg_tags(span, endpoint_name, args, ARGS_NAME, TRACED_ARGS)\n\n        region_name = deep_getattr(instance, 'meta.region_name')\n\n        meta = {\n            'aws.agent': 'aiobotocore',\n            'aws.operation': operation,\n            'aws.region': region_name,\n        }\n        span.set_tags(meta)\n\n        result = yield from original_func(*args, **kwargs)\n\n        body = result.get('Body')\n        if isinstance(body, ClientResponseContentProxy):\n            result['Body'] = WrappedClientResponseContentProxy(body, pin, span)\n\n        response_meta = result['ResponseMetadata']\n        response_headers = response_meta['HTTPHeaders']\n\n        span.set_tag(http.STATUS_CODE, response_meta['HTTPStatusCode'])\n        span.set_tag('retry_attempts', response_meta['RetryAttempts'])\n\n        request_id = response_meta.get('RequestId')\n        if request_id:\n            span.set_tag('aws.requestid', request_id)\n\n        request_id2 = response_headers.get('x-amz-id-2')\n        if request_id2:\n            span.set_tag('aws.requestid2', request_id2)\n\n        # set analytics sample rate\n        span.set_tag(\n            ANALYTICS_SAMPLE_RATE_KEY,\n            config.aiobotocore.get_analytics_sample_rate()\n        )\n\n        return result\n", "path": "ddtrace/contrib/aiobotocore/patch.py"}], "after_files": [{"content": "import asyncio\nfrom ddtrace.vendor import wrapt\nfrom ddtrace import config\nimport aiobotocore.client\n\ntry:\n    from aiobotocore.endpoint import ClientResponseContentProxy\nexcept ImportError:\n    # aiobotocore>=0.11.0\n    from aiobotocore._endpoint_helpers import ClientResponseContentProxy\n\nfrom ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY\nfrom ...pin import Pin\nfrom ...ext import SpanTypes, http, aws\nfrom ...compat import PYTHON_VERSION_INFO\nfrom ...utils.formats import deep_getattr\nfrom ...utils.wrappers import unwrap\n\n\nARGS_NAME = ('action', 'params', 'path', 'verb')\nTRACED_ARGS = ['params', 'path', 'verb']\n\n\ndef patch():\n    if getattr(aiobotocore.client, '_datadog_patch', False):\n        return\n    setattr(aiobotocore.client, '_datadog_patch', True)\n\n    wrapt.wrap_function_wrapper('aiobotocore.client', 'AioBaseClient._make_api_call', _wrapped_api_call)\n    Pin(service='aws', app='aws').onto(aiobotocore.client.AioBaseClient)\n\n\ndef unpatch():\n    if getattr(aiobotocore.client, '_datadog_patch', False):\n        setattr(aiobotocore.client, '_datadog_patch', False)\n        unwrap(aiobotocore.client.AioBaseClient, '_make_api_call')\n\n\nclass WrappedClientResponseContentProxy(wrapt.ObjectProxy):\n    def __init__(self, body, pin, parent_span):\n        super(WrappedClientResponseContentProxy, self).__init__(body)\n        self._self_pin = pin\n        self._self_parent_span = parent_span\n\n    @asyncio.coroutine\n    def read(self, *args, **kwargs):\n        # async read that must be child of the parent span operation\n        operation_name = '{}.read'.format(self._self_parent_span.name)\n\n        with self._self_pin.tracer.start_span(operation_name, child_of=self._self_parent_span) as span:\n            # inherit parent attributes\n            span.resource = self._self_parent_span.resource\n            span.span_type = self._self_parent_span.span_type\n            span.meta = dict(self._self_parent_span.meta)\n            span.metrics = dict(self._self_parent_span.metrics)\n\n            result = yield from self.__wrapped__.read(*args, **kwargs)\n            span.set_tag('Length', len(result))\n\n        return result\n\n    # wrapt doesn't proxy `async with` context managers\n    if PYTHON_VERSION_INFO >= (3, 5, 0):\n        @asyncio.coroutine\n        def __aenter__(self):\n            # call the wrapped method but return the object proxy\n            yield from self.__wrapped__.__aenter__()\n            return self\n\n        @asyncio.coroutine\n        def __aexit__(self, *args, **kwargs):\n            response = yield from self.__wrapped__.__aexit__(*args, **kwargs)\n            return response\n\n\n@asyncio.coroutine\ndef _wrapped_api_call(original_func, instance, args, kwargs):\n    pin = Pin.get_from(instance)\n    if not pin or not pin.enabled():\n        result = yield from original_func(*args, **kwargs)\n        return result\n\n    endpoint_name = deep_getattr(instance, '_endpoint._endpoint_prefix')\n\n    with pin.tracer.trace('{}.command'.format(endpoint_name),\n                          service='{}.{}'.format(pin.service, endpoint_name),\n                          span_type=SpanTypes.HTTP) as span:\n        span.set_tag(SPAN_MEASURED_KEY)\n\n        if len(args) > 0:\n            operation = args[0]\n            span.resource = '{}.{}'.format(endpoint_name, operation.lower())\n        else:\n            operation = None\n            span.resource = endpoint_name\n\n        aws.add_span_arg_tags(span, endpoint_name, args, ARGS_NAME, TRACED_ARGS)\n\n        region_name = deep_getattr(instance, 'meta.region_name')\n\n        meta = {\n            'aws.agent': 'aiobotocore',\n            'aws.operation': operation,\n            'aws.region': region_name,\n        }\n        span.set_tags(meta)\n\n        result = yield from original_func(*args, **kwargs)\n\n        body = result.get('Body')\n        if isinstance(body, ClientResponseContentProxy):\n            result['Body'] = WrappedClientResponseContentProxy(body, pin, span)\n\n        response_meta = result['ResponseMetadata']\n        response_headers = response_meta['HTTPHeaders']\n\n        span.set_tag(http.STATUS_CODE, response_meta['HTTPStatusCode'])\n        span.set_tag('retry_attempts', response_meta['RetryAttempts'])\n\n        request_id = response_meta.get('RequestId')\n        if request_id:\n            span.set_tag('aws.requestid', request_id)\n\n        request_id2 = response_headers.get('x-amz-id-2')\n        if request_id2:\n            span.set_tag('aws.requestid2', request_id2)\n\n        # set analytics sample rate\n        span.set_tag(\n            ANALYTICS_SAMPLE_RATE_KEY,\n            config.aiobotocore.get_analytics_sample_rate()\n        )\n\n        return result\n", "path": "ddtrace/contrib/aiobotocore/patch.py"}]}