prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  redis-py-cluster new API 2.0.0
  ### Which version of dd-trace-py are you using?
   lastest 0.34.0
  
  ### Which version of the libraries are you using?
  
  redis-py-cluster  2.0.0
  
  ### How can we reproduce your problem?
  
  change https://github.com/DataDog/dd-trace-py/blob/master/tox.ini redis-py-cluster version
  
  ### What is the result that you get?
  
  ERROR. It's no more StrictRedisCluster but  just RedisCluster
  
  ### What is result that you expected?
  
  moving to new api
  
  
  </issue>
  <code>
  [start of ddtrace/contrib/rediscluster/patch.py]
  1 # 3p
  2 import rediscluster
  3 from ddtrace.vendor import wrapt
  4 
  5 # project
  6 from ddtrace import config
  7 from ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY
  8 from ...pin import Pin
  9 from ...ext import SpanTypes, redis as redisx
  10 from ...utils.wrappers import unwrap
  11 from ..redis.patch import traced_execute_command, traced_pipeline
  12 from ..redis.util import format_command_args
  13 
  14 
  15 def patch():
  16     """Patch the instrumented methods
  17     """
  18     if getattr(rediscluster, '_datadog_patch', False):
  19         return
  20     setattr(rediscluster, '_datadog_patch', True)
  21 
  22     _w = wrapt.wrap_function_wrapper
  23     _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)
  24     _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)
  25     _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)
  26     Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)
  27 
  28 
  29 def unpatch():
  30     if getattr(rediscluster, '_datadog_patch', False):
  31         setattr(rediscluster, '_datadog_patch', False)
  32         unwrap(rediscluster.StrictRedisCluster, 'execute_command')
  33         unwrap(rediscluster.StrictRedisCluster, 'pipeline')
  34         unwrap(rediscluster.StrictClusterPipeline, 'execute')
  35 
  36 
  37 #
  38 # tracing functions
  39 #
  40 
  41 def traced_execute_pipeline(func, instance, args, kwargs):
  42     pin = Pin.get_from(instance)
  43     if not pin or not pin.enabled():
  44         return func(*args, **kwargs)
  45 
  46     cmds = [format_command_args(c.args) for c in instance.command_stack]
  47     resource = '\n'.join(cmds)
  48     tracer = pin.tracer
  49     with tracer.trace(redisx.CMD, resource=resource, service=pin.service, span_type=SpanTypes.REDIS) as s:
  50         s.set_tag(SPAN_MEASURED_KEY)
  51         s.set_tag(redisx.RAWCMD, resource)
  52         s.set_metric(redisx.PIPELINE_LEN, len(instance.command_stack))
  53 
  54         # set analytics sample rate if enabled
  55         s.set_tag(
  56             ANALYTICS_SAMPLE_RATE_KEY,
  57             config.rediscluster.get_analytics_sample_rate()
  58         )
  59 
  60         return func(*args, **kwargs)
  61
  [end of ddtrace/contrib/rediscluster/patch.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/ddtrace/contrib/rediscluster/patch.py b/ddtrace/contrib/rediscluster/patch.py
  --- a/ddtrace/contrib/rediscluster/patch.py
  +++ b/ddtrace/contrib/rediscluster/patch.py
  @@ -12,6 +12,11 @@
   from ..redis.util import format_command_args
   
   
  +# DEV: In `2.0.0` `__version__` is a string and `VERSION` is a tuple,
  +#      but in `1.x.x` `__version__` is a tuple annd `VERSION` does not exist
  +REDISCLUSTER_VERSION = getattr(rediscluster, 'VERSION', rediscluster.__version__)
  +
  +
   def patch():
       """Patch the instrumented methods
       """
  @@ -20,18 +25,30 @@
       setattr(rediscluster, '_datadog_patch', True)
   
       _w = wrapt.wrap_function_wrapper
  -    _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)
  -    _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)
  -    _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)
  -    Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)
  +    if REDISCLUSTER_VERSION >= (2, 0, 0):
  +        _w('rediscluster', 'RedisCluster.execute_command', traced_execute_command)
  +        _w('rediscluster', 'RedisCluster.pipeline', traced_pipeline)
  +        _w('rediscluster', 'ClusterPipeline.execute', traced_execute_pipeline)
  +        Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.RedisCluster)
  +    else:
  +        _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)
  +        _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)
  +        _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)
  +        Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)
   
   
   def unpatch():
       if getattr(rediscluster, '_datadog_patch', False):
           setattr(rediscluster, '_datadog_patch', False)
  -        unwrap(rediscluster.StrictRedisCluster, 'execute_command')
  -        unwrap(rediscluster.StrictRedisCluster, 'pipeline')
  -        unwrap(rediscluster.StrictClusterPipeline, 'execute')
  +
  +        if REDISCLUSTER_VERSION >= (2, 0, 0):
  +            unwrap(rediscluster.RedisCluster, 'execute_command')
  +            unwrap(rediscluster.RedisCluster, 'pipeline')
  +            unwrap(rediscluster.ClusterPipeline, 'execute')
  +        else:
  +            unwrap(rediscluster.StrictRedisCluster, 'execute_command')
  +            unwrap(rediscluster.StrictRedisCluster, 'pipeline')
  +            unwrap(rediscluster.StrictClusterPipeline, 'execute')
   
   
   #
  
verification_info: {"golden_diff": "diff --git a/ddtrace/contrib/rediscluster/patch.py b/ddtrace/contrib/rediscluster/patch.py\n--- a/ddtrace/contrib/rediscluster/patch.py\n+++ b/ddtrace/contrib/rediscluster/patch.py\n@@ -12,6 +12,11 @@\n from ..redis.util import format_command_args\n \n \n+# DEV: In `2.0.0` `__version__` is a string and `VERSION` is a tuple,\n+#      but in `1.x.x` `__version__` is a tuple annd `VERSION` does not exist\n+REDISCLUSTER_VERSION = getattr(rediscluster, 'VERSION', rediscluster.__version__)\n+\n+\n def patch():\n     \"\"\"Patch the instrumented methods\n     \"\"\"\n@@ -20,18 +25,30 @@\n     setattr(rediscluster, '_datadog_patch', True)\n \n     _w = wrapt.wrap_function_wrapper\n-    _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)\n-    _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)\n-    _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)\n-    Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)\n+    if REDISCLUSTER_VERSION >= (2, 0, 0):\n+        _w('rediscluster', 'RedisCluster.execute_command', traced_execute_command)\n+        _w('rediscluster', 'RedisCluster.pipeline', traced_pipeline)\n+        _w('rediscluster', 'ClusterPipeline.execute', traced_execute_pipeline)\n+        Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.RedisCluster)\n+    else:\n+        _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)\n+        _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)\n+        _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)\n+        Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)\n \n \n def unpatch():\n     if getattr(rediscluster, '_datadog_patch', False):\n         setattr(rediscluster, '_datadog_patch', False)\n-        unwrap(rediscluster.StrictRedisCluster, 'execute_command')\n-        unwrap(rediscluster.StrictRedisCluster, 'pipeline')\n-        unwrap(rediscluster.StrictClusterPipeline, 'execute')\n+\n+        if REDISCLUSTER_VERSION >= (2, 0, 0):\n+            unwrap(rediscluster.RedisCluster, 'execute_command')\n+            unwrap(rediscluster.RedisCluster, 'pipeline')\n+            unwrap(rediscluster.ClusterPipeline, 'execute')\n+        else:\n+            unwrap(rediscluster.StrictRedisCluster, 'execute_command')\n+            unwrap(rediscluster.StrictRedisCluster, 'pipeline')\n+            unwrap(rediscluster.StrictClusterPipeline, 'execute')\n \n \n #\n", "issue": "redis-py-cluster new API 2.0.0\n### Which version of dd-trace-py are you using?\r\n lastest 0.34.0\r\n\r\n### Which version of the libraries are you using?\r\n\r\nredis-py-cluster  2.0.0\r\n\r\n### How can we reproduce your problem?\r\n\r\nchange https://github.com/DataDog/dd-trace-py/blob/master/tox.ini redis-py-cluster version\r\n\r\n### What is the result that you get?\r\n\r\nERROR. It's no more StrictRedisCluster but  just RedisCluster\r\n\r\n### What is result that you expected?\r\n\r\nmoving to new api\r\n\n", "before_files": [{"content": "# 3p\nimport rediscluster\nfrom ddtrace.vendor import wrapt\n\n# project\nfrom ddtrace import config\nfrom ...constants import ANALYTICS_SAMPLE_RATE_KEY, SPAN_MEASURED_KEY\nfrom ...pin import Pin\nfrom ...ext import SpanTypes, redis as redisx\nfrom ...utils.wrappers import unwrap\nfrom ..redis.patch import traced_execute_command, traced_pipeline\nfrom ..redis.util import format_command_args\n\n\ndef patch():\n    \"\"\"Patch the instrumented methods\n    \"\"\"\n    if getattr(rediscluster, '_datadog_patch', False):\n        return\n    setattr(rediscluster, '_datadog_patch', True)\n\n    _w = wrapt.wrap_function_wrapper\n    _w('rediscluster', 'StrictRedisCluster.execute_command', traced_execute_command)\n    _w('rediscluster', 'StrictRedisCluster.pipeline', traced_pipeline)\n    _w('rediscluster', 'StrictClusterPipeline.execute', traced_execute_pipeline)\n    Pin(service=redisx.DEFAULT_SERVICE, app=redisx.APP).onto(rediscluster.StrictRedisCluster)\n\n\ndef unpatch():\n    if getattr(rediscluster, '_datadog_patch', False):\n        setattr(rediscluster, '_datadog_patch', False)\n        unwrap(rediscluster.StrictRedisCluster, 'execute_command')\n        unwrap(rediscluster.StrictRedisCluster, 'pipeline')\n        unwrap(rediscluster.StrictClusterPipeline, 'execute')\n\n\n#\n# tracing functions\n#\n\ndef traced_execute_pipeline(func, instance, args, kwargs):\n    pin = Pin.get_from(instance)\n    if not pin or not pin.enabled():\n        return func(*args, **kwargs)\n\n    cmds = [format_command_args(c.args) for c in instance.command_stack]\n    resource = '\\n'.join(cmds)\n    tracer = pin.tracer\n    with tracer.trace(redisx.CMD, resource=resource, service=pin.service, span_type=SpanTypes.REDIS) as s:\n        s.set_tag(SPAN_MEASURED_KEY)\n        s.set_tag(redisx.RAWCMD, resource)\n        s.set_metric(redisx.PIPELINE_LEN, len(instance.command_stack))\n\n        # set analytics sample rate if enabled\n        s.set_tag(\n            ANALYTICS_SAMPLE_RATE_KEY,\n            config.rediscluster.get_analytics_sample_rate()\n        )\n\n        return func(*args, **kwargs)\n", "path": "ddtrace/contrib/rediscluster/patch.py"}]}