We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Consolidate serialization helpers to be static and shared
In the teams_helper there are 2 serialization helper methods. Currently they both create a big dict of all the Model objects that exist in Teams and BF. We should make the optimization to make the big dict once, and update the 2 helpers to use the new dict.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py`
Content:
```
1 # Copyright (c) Microsoft Corporation. All rights reserved.
2 # Licensed under the MIT License.
3 
4 from inspect import getmembers
5 from typing import Type
6 from enum import Enum
7 
8 from msrest.serialization import Model, Deserializer, Serializer
9 
10 import botbuilder.schema as schema
11 import botbuilder.schema.teams as teams_schema
12 
13 # Optimization: The dependencies dictionary could be cached here,
14 # and shared between the two methods.
15 
16 
17 def deserializer_helper(msrest_cls: Type[Model], dict_to_deserialize: dict) -> Model:
18     dependencies = [
19         schema_cls
20         for key, schema_cls in getmembers(schema)
21         if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
22     ]
23     dependencies += [
24         schema_cls
25         for key, schema_cls in getmembers(teams_schema)
26         if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
27     ]
28     dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}
29     deserializer = Deserializer(dependencies_dict)
30     return deserializer(msrest_cls.__name__, dict_to_deserialize)
31 
32 
33 def serializer_helper(object_to_serialize: Model) -> dict:
34     if object_to_serialize is None:
35         return None
36 
37     dependencies = [
38         schema_cls
39         for key, schema_cls in getmembers(schema)
40         if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
41     ]
42     dependencies += [
43         schema_cls
44         for key, schema_cls in getmembers(teams_schema)
45         if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
46     ]
47     dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}
48     serializer = Serializer(dependencies_dict)
49     # pylint: disable=protected-access
50     return serializer._serialize(object_to_serialize)
51
```
--- 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/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py
--- a/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py
+++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py
@@ -10,23 +10,21 @@
 import botbuilder.schema as schema
 import botbuilder.schema.teams as teams_schema
 
-# Optimization: The dependencies dictionary could be cached here,
-# and shared between the two methods.
+DEPENDICIES = [
+    schema_cls
+    for key, schema_cls in getmembers(schema)
+    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
+]
+DEPENDICIES += [
+    schema_cls
+    for key, schema_cls in getmembers(teams_schema)
+    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
+]
+DEPENDICIES_DICT = {dependency.__name__: dependency for dependency in DEPENDICIES}
 
 
 def deserializer_helper(msrest_cls: Type[Model], dict_to_deserialize: dict) -> Model:
-    dependencies = [
-        schema_cls
-        for key, schema_cls in getmembers(schema)
-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
-    ]
-    dependencies += [
-        schema_cls
-        for key, schema_cls in getmembers(teams_schema)
-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
-    ]
-    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}
-    deserializer = Deserializer(dependencies_dict)
+    deserializer = Deserializer(DEPENDICIES_DICT)
     return deserializer(msrest_cls.__name__, dict_to_deserialize)
 
 
@@ -34,17 +32,6 @@
     if object_to_serialize is None:
         return None
 
-    dependencies = [
-        schema_cls
-        for key, schema_cls in getmembers(schema)
-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
-    ]
-    dependencies += [
-        schema_cls
-        for key, schema_cls in getmembers(teams_schema)
-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))
-    ]
-    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}
-    serializer = Serializer(dependencies_dict)
+    serializer = Serializer(DEPENDICIES_DICT)
     # pylint: disable=protected-access
     return serializer._serialize(object_to_serialize)

{"golden_diff": "diff --git a/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py\n--- a/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py\n+++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py\n@@ -10,23 +10,21 @@\n import botbuilder.schema as schema\n import botbuilder.schema.teams as teams_schema\n \n-# Optimization: The dependencies dictionary could be cached here,\n-# and shared between the two methods.\n+DEPENDICIES = [\n+    schema_cls\n+    for key, schema_cls in getmembers(schema)\n+    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n+]\n+DEPENDICIES += [\n+    schema_cls\n+    for key, schema_cls in getmembers(teams_schema)\n+    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n+]\n+DEPENDICIES_DICT = {dependency.__name__: dependency for dependency in DEPENDICIES}\n \n \n def deserializer_helper(msrest_cls: Type[Model], dict_to_deserialize: dict) -> Model:\n-    dependencies = [\n-        schema_cls\n-        for key, schema_cls in getmembers(schema)\n-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n-    ]\n-    dependencies += [\n-        schema_cls\n-        for key, schema_cls in getmembers(teams_schema)\n-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n-    ]\n-    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}\n-    deserializer = Deserializer(dependencies_dict)\n+    deserializer = Deserializer(DEPENDICIES_DICT)\n     return deserializer(msrest_cls.__name__, dict_to_deserialize)\n \n \n@@ -34,17 +32,6 @@\n     if object_to_serialize is None:\n         return None\n \n-    dependencies = [\n-        schema_cls\n-        for key, schema_cls in getmembers(schema)\n-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n-    ]\n-    dependencies += [\n-        schema_cls\n-        for key, schema_cls in getmembers(teams_schema)\n-        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n-    ]\n-    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}\n-    serializer = Serializer(dependencies_dict)\n+    serializer = Serializer(DEPENDICIES_DICT)\n     # pylint: disable=protected-access\n     return serializer._serialize(object_to_serialize)\n", "issue": "Consolidate serialization helpers to be static and shared\nIn the teams_helper there are 2 serialization helper methods. Currently they both create a big dict of all the Model objects that exist in Teams and BF. We should make the optimization to make the big dict once, and update the 2 helpers to use the new dict.\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\nfrom inspect import getmembers\nfrom typing import Type\nfrom enum import Enum\n\nfrom msrest.serialization import Model, Deserializer, Serializer\n\nimport botbuilder.schema as schema\nimport botbuilder.schema.teams as teams_schema\n\n# Optimization: The dependencies dictionary could be cached here,\n# and shared between the two methods.\n\n\ndef deserializer_helper(msrest_cls: Type[Model], dict_to_deserialize: dict) -> Model:\n    dependencies = [\n        schema_cls\n        for key, schema_cls in getmembers(schema)\n        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n    ]\n    dependencies += [\n        schema_cls\n        for key, schema_cls in getmembers(teams_schema)\n        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n    ]\n    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}\n    deserializer = Deserializer(dependencies_dict)\n    return deserializer(msrest_cls.__name__, dict_to_deserialize)\n\n\ndef serializer_helper(object_to_serialize: Model) -> dict:\n    if object_to_serialize is None:\n        return None\n\n    dependencies = [\n        schema_cls\n        for key, schema_cls in getmembers(schema)\n        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n    ]\n    dependencies += [\n        schema_cls\n        for key, schema_cls in getmembers(teams_schema)\n        if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n    ]\n    dependencies_dict = {dependency.__name__: dependency for dependency in dependencies}\n    serializer = Serializer(dependencies_dict)\n    # pylint: disable=protected-access\n    return serializer._serialize(object_to_serialize)\n", "path": "libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\nfrom inspect import getmembers\nfrom typing import Type\nfrom enum import Enum\n\nfrom msrest.serialization import Model, Deserializer, Serializer\n\nimport botbuilder.schema as schema\nimport botbuilder.schema.teams as teams_schema\n\nDEPENDICIES = [\n    schema_cls\n    for key, schema_cls in getmembers(schema)\n    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n]\nDEPENDICIES += [\n    schema_cls\n    for key, schema_cls in getmembers(teams_schema)\n    if isinstance(schema_cls, type) and issubclass(schema_cls, (Model, Enum))\n]\nDEPENDICIES_DICT = {dependency.__name__: dependency for dependency in DEPENDICIES}\n\n\ndef deserializer_helper(msrest_cls: Type[Model], dict_to_deserialize: dict) -> Model:\n    deserializer = Deserializer(DEPENDICIES_DICT)\n    return deserializer(msrest_cls.__name__, dict_to_deserialize)\n\n\ndef serializer_helper(object_to_serialize: Model) -> dict:\n    if object_to_serialize is None:\n        return None\n\n    serializer = Serializer(DEPENDICIES_DICT)\n    # pylint: disable=protected-access\n    return serializer._serialize(object_to_serialize)\n", "path": "libraries/botbuilder-core/botbuilder/core/teams/teams_helper.py"}]}