We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Metadata should have language / language_version fields
Standardizing metadata between the various agents - put a fixed `python` string in `language`, and  the version (`3.4.1` or whatever) in `language_version`

Keep the existing fields for now. Need to ensure that the CoreAgent handles them nicely when missing.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/scout_apm/core/metadata.py`
Content:
```
1 # coding=utf-8
2 from __future__ import absolute_import, division, print_function, unicode_literals
3 
4 import datetime as dt
5 import logging
6 import sys
7 from os import getpid
8 
9 from scout_apm.core.commands import ApplicationEvent
10 from scout_apm.core.config import scout_config
11 from scout_apm.core.socket import CoreAgentSocket
12 
13 logger = logging.getLogger(__name__)
14 
15 
16 class AppMetadata(object):
17     @classmethod
18     def report(cls):
19         event = ApplicationEvent(
20             event_type="scout.metadata",
21             event_value=cls.data(),
22             source="Pid: " + str(getpid()),
23             timestamp=dt.datetime.utcnow(),
24         )
25         CoreAgentSocket.instance().send(event)
26 
27     @classmethod
28     def data(cls):
29         try:
30             data = {
31                 "language": "python",
32                 "version": "{}.{}.{}".format(*sys.version_info[:3]),
33                 "server_time": dt.datetime.utcnow().isoformat() + "Z",
34                 "framework": scout_config.value("framework"),
35                 "framework_version": scout_config.value("framework_version"),
36                 "environment": "",
37                 "app_server": scout_config.value("app_server"),
38                 "hostname": scout_config.value("hostname"),
39                 "database_engine": "",  # Detected
40                 "database_adapter": "",  # Raw
41                 "application_name": "",  # Environment.application_name,
42                 "libraries": cls.get_python_packages_versions(),
43                 "paas": "",
44                 "application_root": scout_config.value("application_root"),
45                 "scm_subdirectory": scout_config.value("scm_subdirectory"),
46                 "git_sha": scout_config.value("revision_sha"),
47             }
48         except Exception as e:
49             logger.debug("Exception in AppMetadata: %r", e)
50             data = {}
51 
52         return data
53 
54     @classmethod
55     def get_python_packages_versions(cls):
56         try:
57             import pkg_resources
58         except ImportError:
59             return []
60 
61         return list(
62             sorted(
63                 (distribution.project_name, distribution.version)
64                 for distribution in pkg_resources.working_set
65             )
66         )
67
```
--- 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/src/scout_apm/core/metadata.py b/src/scout_apm/core/metadata.py
--- a/src/scout_apm/core/metadata.py
+++ b/src/scout_apm/core/metadata.py
@@ -29,6 +29,8 @@
         try:
             data = {
                 "language": "python",
+                "language_version": "{}.{}.{}".format(*sys.version_info[:3]),
+                # Deprecated: (see #327)
                 "version": "{}.{}.{}".format(*sys.version_info[:3]),
                 "server_time": dt.datetime.utcnow().isoformat() + "Z",
                 "framework": scout_config.value("framework"),

{"golden_diff": "diff --git a/src/scout_apm/core/metadata.py b/src/scout_apm/core/metadata.py\n--- a/src/scout_apm/core/metadata.py\n+++ b/src/scout_apm/core/metadata.py\n@@ -29,6 +29,8 @@\n         try:\n             data = {\n                 \"language\": \"python\",\n+                \"language_version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n+                # Deprecated: (see #327)\n                 \"version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                 \"server_time\": dt.datetime.utcnow().isoformat() + \"Z\",\n                 \"framework\": scout_config.value(\"framework\"),\n", "issue": "Metadata should have language / language_version fields\nStandardizing metadata between the various agents - put a fixed `python` string in `language`, and  the version (`3.4.1` or whatever) in `language_version`\r\n\r\nKeep the existing fields for now. Need to ensure that the CoreAgent handles them nicely when missing.\n", "before_files": [{"content": "# coding=utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport datetime as dt\nimport logging\nimport sys\nfrom os import getpid\n\nfrom scout_apm.core.commands import ApplicationEvent\nfrom scout_apm.core.config import scout_config\nfrom scout_apm.core.socket import CoreAgentSocket\n\nlogger = logging.getLogger(__name__)\n\n\nclass AppMetadata(object):\n    @classmethod\n    def report(cls):\n        event = ApplicationEvent(\n            event_type=\"scout.metadata\",\n            event_value=cls.data(),\n            source=\"Pid: \" + str(getpid()),\n            timestamp=dt.datetime.utcnow(),\n        )\n        CoreAgentSocket.instance().send(event)\n\n    @classmethod\n    def data(cls):\n        try:\n            data = {\n                \"language\": \"python\",\n                \"version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                \"server_time\": dt.datetime.utcnow().isoformat() + \"Z\",\n                \"framework\": scout_config.value(\"framework\"),\n                \"framework_version\": scout_config.value(\"framework_version\"),\n                \"environment\": \"\",\n                \"app_server\": scout_config.value(\"app_server\"),\n                \"hostname\": scout_config.value(\"hostname\"),\n                \"database_engine\": \"\",  # Detected\n                \"database_adapter\": \"\",  # Raw\n                \"application_name\": \"\",  # Environment.application_name,\n                \"libraries\": cls.get_python_packages_versions(),\n                \"paas\": \"\",\n                \"application_root\": scout_config.value(\"application_root\"),\n                \"scm_subdirectory\": scout_config.value(\"scm_subdirectory\"),\n                \"git_sha\": scout_config.value(\"revision_sha\"),\n            }\n        except Exception as e:\n            logger.debug(\"Exception in AppMetadata: %r\", e)\n            data = {}\n\n        return data\n\n    @classmethod\n    def get_python_packages_versions(cls):\n        try:\n            import pkg_resources\n        except ImportError:\n            return []\n\n        return list(\n            sorted(\n                (distribution.project_name, distribution.version)\n                for distribution in pkg_resources.working_set\n            )\n        )\n", "path": "src/scout_apm/core/metadata.py"}], "after_files": [{"content": "# coding=utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport datetime as dt\nimport logging\nimport sys\nfrom os import getpid\n\nfrom scout_apm.core.commands import ApplicationEvent\nfrom scout_apm.core.config import scout_config\nfrom scout_apm.core.socket import CoreAgentSocket\n\nlogger = logging.getLogger(__name__)\n\n\nclass AppMetadata(object):\n    @classmethod\n    def report(cls):\n        event = ApplicationEvent(\n            event_type=\"scout.metadata\",\n            event_value=cls.data(),\n            source=\"Pid: \" + str(getpid()),\n            timestamp=dt.datetime.utcnow(),\n        )\n        CoreAgentSocket.instance().send(event)\n\n    @classmethod\n    def data(cls):\n        try:\n            data = {\n                \"language\": \"python\",\n                \"language_version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                # Deprecated: (see #327)\n                \"version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                \"server_time\": dt.datetime.utcnow().isoformat() + \"Z\",\n                \"framework\": scout_config.value(\"framework\"),\n                \"framework_version\": scout_config.value(\"framework_version\"),\n                \"environment\": \"\",\n                \"app_server\": scout_config.value(\"app_server\"),\n                \"hostname\": scout_config.value(\"hostname\"),\n                \"database_engine\": \"\",  # Detected\n                \"database_adapter\": \"\",  # Raw\n                \"application_name\": \"\",  # Environment.application_name,\n                \"libraries\": cls.get_python_packages_versions(),\n                \"paas\": \"\",\n                \"application_root\": scout_config.value(\"application_root\"),\n                \"scm_subdirectory\": scout_config.value(\"scm_subdirectory\"),\n                \"git_sha\": scout_config.value(\"revision_sha\"),\n            }\n        except Exception as e:\n            logger.debug(\"Exception in AppMetadata: %r\", e)\n            data = {}\n\n        return data\n\n    @classmethod\n    def get_python_packages_versions(cls):\n        try:\n            import pkg_resources\n        except ImportError:\n            return []\n\n        return list(\n            sorted(\n                (distribution.project_name, distribution.version)\n                for distribution in pkg_resources.working_set\n            )\n        )\n", "path": "src/scout_apm/core/metadata.py"}]}