prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Pinned eventlet version has outstanding bugs
  pinned version 0.17 of eventlet has outstanding bugs on it's monkey patching of the ssl module.
  
  e.g.
  https://github.com/eventlet/eventlet/issues/371
  
  ```
  # Note: 0.20.0 removed select.poll() on which some of our code and libraries we
  # depend on rely
  ```
  
  @Kami  committed this reversion in https://github.com/StackStorm/st2/commit/1ec43d294e6770e56ec8f9990c805cb9dffe98c5
  
  What was the specific issue?
  
  </issue>
  <code>
  [start of st2common/st2common/util/monkey_patch.py]
  1 # Licensed to the StackStorm, Inc ('StackStorm') under one or more
  2 # contributor license agreements.  See the NOTICE file distributed with
  3 # this work for additional information regarding copyright ownership.
  4 # The ASF licenses this file to You under the Apache License, Version 2.0
  5 # (the "License"); you may not use this file except in compliance with
  6 # the License.  You may obtain a copy of the License at
  7 #
  8 #     http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 #
  15 
  16 """
  17 Module for performing eventlet and other monkey patching.
  18 """
  19 
  20 from __future__ import absolute_import
  21 
  22 import sys
  23 
  24 __all__ = [
  25     'monkey_patch',
  26     'is_use_debugger_flag_provided'
  27 ]
  28 
  29 USE_DEBUGGER_FLAG = '--use-debugger'
  30 PARENT_ARGS_FLAG = '--parent-args='
  31 
  32 
  33 def monkey_patch():
  34     """
  35     Function which performs eventlet monkey patching and also takes into account "--use-debugger"
  36     argument in the command line arguments.
  37 
  38     If this argument is found, no monkey patching is performed for the thread module. This allows
  39     user to use remote debuggers.
  40     """
  41     import eventlet
  42 
  43     patch_thread = not is_use_debugger_flag_provided()
  44     eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True)
  45 
  46 
  47 def is_use_debugger_flag_provided():
  48     # 1. Check sys.argv directly
  49     if USE_DEBUGGER_FLAG in sys.argv:
  50         return True
  51 
  52     # 2. Check "parent-args" arguments. This is used for spawned processes such as sensors and
  53     # Python runner actions
  54 
  55     for arg in sys.argv:
  56         if arg.startswith(PARENT_ARGS_FLAG) and USE_DEBUGGER_FLAG in arg:
  57             return True
  58 
  59     return False
  60
  [end of st2common/st2common/util/monkey_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/st2common/st2common/util/monkey_patch.py b/st2common/st2common/util/monkey_patch.py
  --- a/st2common/st2common/util/monkey_patch.py
  +++ b/st2common/st2common/util/monkey_patch.py
  @@ -23,6 +23,7 @@
   
   __all__ = [
       'monkey_patch',
  +    'use_select_poll_workaround',
       'is_use_debugger_flag_provided'
   ]
   
  @@ -44,6 +45,21 @@
       eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True)
   
   
  +def use_select_poll_workaround():
  +    """
  +    Work around for some tests which injects original select module with select.poll()
  +    available to sys.modules.
  +    """
  +    import sys
  +    import subprocess
  +    import eventlet
  +
  +    # Work around to get tests to pass with eventlet >= 0.20.0
  +    if 'nose' in sys.modules.keys():
  +        sys.modules['select'] = eventlet.patcher.original('select')
  +        subprocess.select = eventlet.patcher.original('select')
  +
  +
   def is_use_debugger_flag_provided():
       # 1. Check sys.argv directly
       if USE_DEBUGGER_FLAG in sys.argv:
  
verification_info: {"golden_diff": "diff --git a/st2common/st2common/util/monkey_patch.py b/st2common/st2common/util/monkey_patch.py\n--- a/st2common/st2common/util/monkey_patch.py\n+++ b/st2common/st2common/util/monkey_patch.py\n@@ -23,6 +23,7 @@\n \n __all__ = [\n     'monkey_patch',\n+    'use_select_poll_workaround',\n     'is_use_debugger_flag_provided'\n ]\n \n@@ -44,6 +45,21 @@\n     eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True)\n \n \n+def use_select_poll_workaround():\n+    \"\"\"\n+    Work around for some tests which injects original select module with select.poll()\n+    available to sys.modules.\n+    \"\"\"\n+    import sys\n+    import subprocess\n+    import eventlet\n+\n+    # Work around to get tests to pass with eventlet >= 0.20.0\n+    if 'nose' in sys.modules.keys():\n+        sys.modules['select'] = eventlet.patcher.original('select')\n+        subprocess.select = eventlet.patcher.original('select')\n+\n+\n def is_use_debugger_flag_provided():\n     # 1. Check sys.argv directly\n     if USE_DEBUGGER_FLAG in sys.argv:\n", "issue": "Pinned eventlet version has outstanding bugs\npinned version 0.17 of eventlet has outstanding bugs on it's monkey patching of the ssl module.\r\n\r\ne.g.\r\nhttps://github.com/eventlet/eventlet/issues/371\r\n\r\n```\r\n# Note: 0.20.0 removed select.poll() on which some of our code and libraries we\r\n# depend on rely\r\n```\r\n\r\n@Kami  committed this reversion in https://github.com/StackStorm/st2/commit/1ec43d294e6770e56ec8f9990c805cb9dffe98c5\r\n\r\nWhat was the specific issue?\n", "before_files": [{"content": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements.  See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n#\n\n\"\"\"\nModule for performing eventlet and other monkey patching.\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport sys\n\n__all__ = [\n    'monkey_patch',\n    'is_use_debugger_flag_provided'\n]\n\nUSE_DEBUGGER_FLAG = '--use-debugger'\nPARENT_ARGS_FLAG = '--parent-args='\n\n\ndef monkey_patch():\n    \"\"\"\n    Function which performs eventlet monkey patching and also takes into account \"--use-debugger\"\n    argument in the command line arguments.\n\n    If this argument is found, no monkey patching is performed for the thread module. This allows\n    user to use remote debuggers.\n    \"\"\"\n    import eventlet\n\n    patch_thread = not is_use_debugger_flag_provided()\n    eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True)\n\n\ndef is_use_debugger_flag_provided():\n    # 1. Check sys.argv directly\n    if USE_DEBUGGER_FLAG in sys.argv:\n        return True\n\n    # 2. Check \"parent-args\" arguments. This is used for spawned processes such as sensors and\n    # Python runner actions\n\n    for arg in sys.argv:\n        if arg.startswith(PARENT_ARGS_FLAG) and USE_DEBUGGER_FLAG in arg:\n            return True\n\n    return False\n", "path": "st2common/st2common/util/monkey_patch.py"}]}