We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Unexpected Snake Case for Acronyms
The snake case conversion of the `snake_case_fallback_resolvers` yields unexpected results for words with multiple uppercase letters in a row, e.g.
 - `getHTTPResponse` is converted to `get_h_t_t_p_response`, or
 - `externalID` is converted to "external_i_d`.  

These are unlikely names for python attributes and I would expect the resolver to look for `get_http_response` / `external_id` instead.

Possible implementations for the camel to snake case conversions are discussed here: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case
Unexpected Snake Case for Acronyms
The snake case conversion of the `snake_case_fallback_resolvers` yields unexpected results for words with multiple uppercase letters in a row, e.g.
 - `getHTTPResponse` is converted to `get_h_t_t_p_response`, or
 - `externalID` is converted to "external_i_d`.  

These are unlikely names for python attributes and I would expect the resolver to look for `get_http_response` / `external_id` instead.

Possible implementations for the camel to snake case conversions are discussed here: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ariadne/utils.py`
Content:
```
1 import asyncio
2 from functools import wraps
3 from typing import Optional, Union, Callable, Dict, Any
4 
5 from graphql import GraphQLError, parse
6 
7 
8 def convert_camel_case_to_snake(graphql_name: str) -> str:
9     python_name = ""
10     for i, c in enumerate(graphql_name.lower()):
11         if (
12             i > 0
13             and (
14                 all(
15                     (
16                         c != graphql_name[i],
17                         graphql_name[i - 1] != "_",
18                         graphql_name[i - 1] == python_name[-1],
19                     )
20                 )
21             )
22             or all((c.isdigit(), graphql_name[i - 1].isdigit() is False))
23         ):
24             python_name += "_"
25         python_name += c
26     return python_name
27 
28 
29 def gql(value: str) -> str:
30     parse(value)
31     return value
32 
33 
34 def unwrap_graphql_error(
35     error: Union[GraphQLError, Optional[Exception]]
36 ) -> Optional[Exception]:
37     if isinstance(error, GraphQLError):
38         return unwrap_graphql_error(error.original_error)
39     return error
40 
41 
42 def convert_kwargs_to_snake_case(func: Callable) -> Callable:
43     def convert_to_snake_case(d: Dict) -> Dict:
44         converted: Dict = {}
45         for k, v in d.items():
46             if isinstance(v, dict):
47                 v = convert_to_snake_case(v)
48             if isinstance(v, list):
49                 v = [convert_to_snake_case(i) if isinstance(i, dict) else i for i in v]
50             converted[convert_camel_case_to_snake(k)] = v
51         return converted
52 
53     if asyncio.iscoroutinefunction(func):
54 
55         @wraps(func)
56         async def async_wrapper(*args: Any, **kwargs: Any) -> Any:
57             return await func(*args, **convert_to_snake_case(kwargs))
58 
59         return async_wrapper
60 
61     @wraps(func)
62     def wrapper(*args: Any, **kwargs: Any) -> Any:
63         return func(*args, **convert_to_snake_case(kwargs))
64 
65     return wrapper
66
```
--- 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/ariadne/utils.py b/ariadne/utils.py
--- a/ariadne/utils.py
+++ b/ariadne/utils.py
@@ -6,20 +6,29 @@
 
 
 def convert_camel_case_to_snake(graphql_name: str) -> str:
+    # pylint: disable=too-many-boolean-expressions
+    max_index = len(graphql_name) - 1
+    lowered_name = graphql_name.lower()
+
     python_name = ""
-    for i, c in enumerate(graphql_name.lower()):
-        if (
-            i > 0
-            and (
-                all(
-                    (
-                        c != graphql_name[i],
-                        graphql_name[i - 1] != "_",
-                        graphql_name[i - 1] == python_name[-1],
-                    )
-                )
+    for i, c in enumerate(lowered_name):
+        if i > 0 and (
+            # testWord -> test_word
+            (
+                c != graphql_name[i]
+                and graphql_name[i - 1] != "_"
+                and graphql_name[i - 1] == python_name[-1]
+            )
+            # TESTWord -> test_word
+            or (
+                i < max_index
+                and graphql_name[i] != lowered_name[i]
+                and graphql_name[i + 1] == lowered_name[i + 1]
             )
-            or all((c.isdigit(), graphql_name[i - 1].isdigit() is False))
+            # test134 -> test_134
+            or (c.isdigit() and not graphql_name[i - 1].isdigit())
+            # 134test -> 134_test
+            or (not c.isdigit() and graphql_name[i - 1].isdigit())
         ):
             python_name += "_"
         python_name += c

{"golden_diff": "diff --git a/ariadne/utils.py b/ariadne/utils.py\n--- a/ariadne/utils.py\n+++ b/ariadne/utils.py\n@@ -6,20 +6,29 @@\n \n \n def convert_camel_case_to_snake(graphql_name: str) -> str:\n+    # pylint: disable=too-many-boolean-expressions\n+    max_index = len(graphql_name) - 1\n+    lowered_name = graphql_name.lower()\n+\n     python_name = \"\"\n-    for i, c in enumerate(graphql_name.lower()):\n-        if (\n-            i > 0\n-            and (\n-                all(\n-                    (\n-                        c != graphql_name[i],\n-                        graphql_name[i - 1] != \"_\",\n-                        graphql_name[i - 1] == python_name[-1],\n-                    )\n-                )\n+    for i, c in enumerate(lowered_name):\n+        if i > 0 and (\n+            # testWord -> test_word\n+            (\n+                c != graphql_name[i]\n+                and graphql_name[i - 1] != \"_\"\n+                and graphql_name[i - 1] == python_name[-1]\n+            )\n+            # TESTWord -> test_word\n+            or (\n+                i < max_index\n+                and graphql_name[i] != lowered_name[i]\n+                and graphql_name[i + 1] == lowered_name[i + 1]\n             )\n-            or all((c.isdigit(), graphql_name[i - 1].isdigit() is False))\n+            # test134 -> test_134\n+            or (c.isdigit() and not graphql_name[i - 1].isdigit())\n+            # 134test -> 134_test\n+            or (not c.isdigit() and graphql_name[i - 1].isdigit())\n         ):\n             python_name += \"_\"\n         python_name += c\n", "issue": "Unexpected Snake Case for Acronyms\nThe snake case conversion of the `snake_case_fallback_resolvers` yields unexpected results for words with multiple uppercase letters in a row, e.g.\r\n - `getHTTPResponse` is converted to `get_h_t_t_p_response`, or\r\n - `externalID` is converted to \"external_i_d`.  \r\n\r\nThese are unlikely names for python attributes and I would expect the resolver to look for `get_http_response` / `external_id` instead.\r\n\r\nPossible implementations for the camel to snake case conversions are discussed here: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case\nUnexpected Snake Case for Acronyms\nThe snake case conversion of the `snake_case_fallback_resolvers` yields unexpected results for words with multiple uppercase letters in a row, e.g.\r\n - `getHTTPResponse` is converted to `get_h_t_t_p_response`, or\r\n - `externalID` is converted to \"external_i_d`.  \r\n\r\nThese are unlikely names for python attributes and I would expect the resolver to look for `get_http_response` / `external_id` instead.\r\n\r\nPossible implementations for the camel to snake case conversions are discussed here: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case\n", "before_files": [{"content": "import asyncio\nfrom functools import wraps\nfrom typing import Optional, Union, Callable, Dict, Any\n\nfrom graphql import GraphQLError, parse\n\n\ndef convert_camel_case_to_snake(graphql_name: str) -> str:\n    python_name = \"\"\n    for i, c in enumerate(graphql_name.lower()):\n        if (\n            i > 0\n            and (\n                all(\n                    (\n                        c != graphql_name[i],\n                        graphql_name[i - 1] != \"_\",\n                        graphql_name[i - 1] == python_name[-1],\n                    )\n                )\n            )\n            or all((c.isdigit(), graphql_name[i - 1].isdigit() is False))\n        ):\n            python_name += \"_\"\n        python_name += c\n    return python_name\n\n\ndef gql(value: str) -> str:\n    parse(value)\n    return value\n\n\ndef unwrap_graphql_error(\n    error: Union[GraphQLError, Optional[Exception]]\n) -> Optional[Exception]:\n    if isinstance(error, GraphQLError):\n        return unwrap_graphql_error(error.original_error)\n    return error\n\n\ndef convert_kwargs_to_snake_case(func: Callable) -> Callable:\n    def convert_to_snake_case(d: Dict) -> Dict:\n        converted: Dict = {}\n        for k, v in d.items():\n            if isinstance(v, dict):\n                v = convert_to_snake_case(v)\n            if isinstance(v, list):\n                v = [convert_to_snake_case(i) if isinstance(i, dict) else i for i in v]\n            converted[convert_camel_case_to_snake(k)] = v\n        return converted\n\n    if asyncio.iscoroutinefunction(func):\n\n        @wraps(func)\n        async def async_wrapper(*args: Any, **kwargs: Any) -> Any:\n            return await func(*args, **convert_to_snake_case(kwargs))\n\n        return async_wrapper\n\n    @wraps(func)\n    def wrapper(*args: Any, **kwargs: Any) -> Any:\n        return func(*args, **convert_to_snake_case(kwargs))\n\n    return wrapper\n", "path": "ariadne/utils.py"}], "after_files": [{"content": "import asyncio\nfrom functools import wraps\nfrom typing import Optional, Union, Callable, Dict, Any\n\nfrom graphql import GraphQLError, parse\n\n\ndef convert_camel_case_to_snake(graphql_name: str) -> str:\n    # pylint: disable=too-many-boolean-expressions\n    max_index = len(graphql_name) - 1\n    lowered_name = graphql_name.lower()\n\n    python_name = \"\"\n    for i, c in enumerate(lowered_name):\n        if i > 0 and (\n            # testWord -> test_word\n            (\n                c != graphql_name[i]\n                and graphql_name[i - 1] != \"_\"\n                and graphql_name[i - 1] == python_name[-1]\n            )\n            # TESTWord -> test_word\n            or (\n                i < max_index\n                and graphql_name[i] != lowered_name[i]\n                and graphql_name[i + 1] == lowered_name[i + 1]\n            )\n            # test134 -> test_134\n            or (c.isdigit() and not graphql_name[i - 1].isdigit())\n            # 134test -> 134_test\n            or (not c.isdigit() and graphql_name[i - 1].isdigit())\n        ):\n            python_name += \"_\"\n        python_name += c\n    return python_name\n\n\ndef gql(value: str) -> str:\n    parse(value)\n    return value\n\n\ndef unwrap_graphql_error(\n    error: Union[GraphQLError, Optional[Exception]]\n) -> Optional[Exception]:\n    if isinstance(error, GraphQLError):\n        return unwrap_graphql_error(error.original_error)\n    return error\n\n\ndef convert_kwargs_to_snake_case(func: Callable) -> Callable:\n    def convert_to_snake_case(d: Dict) -> Dict:\n        converted: Dict = {}\n        for k, v in d.items():\n            if isinstance(v, dict):\n                v = convert_to_snake_case(v)\n            if isinstance(v, list):\n                v = [convert_to_snake_case(i) if isinstance(i, dict) else i for i in v]\n            converted[convert_camel_case_to_snake(k)] = v\n        return converted\n\n    if asyncio.iscoroutinefunction(func):\n\n        @wraps(func)\n        async def async_wrapper(*args: Any, **kwargs: Any) -> Any:\n            return await func(*args, **convert_to_snake_case(kwargs))\n\n        return async_wrapper\n\n    @wraps(func)\n    def wrapper(*args: Any, **kwargs: Any) -> Any:\n        return func(*args, **convert_to_snake_case(kwargs))\n\n    return wrapper\n", "path": "ariadne/utils.py"}]}