We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `st2common/st2common/util/monkey_patch.py`
Content:
```
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 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()

```

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:

{"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"}], "after_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    'use_select_poll_workaround',\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 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\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"}]}