We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
gTTS needs to be upgraded to 2.2.2 on dev branch
**Describe the bug**
When using Google TTS, the audio service returns an error and never returns audio.
```
2021-02-06 02:39:24.895 | ERROR    |     1 | mycroft.audio.speech:mute_and_speak:134 | TTS execution failed (gTTSError('200 (OK) from TTS API. Probable cause: Unknown'))
```

I had to upgrade `gTTS` from `2.2.0` to `2.2.2` to fix the issue.

```
pip install gTTS -U
Collecting gTTS
  Downloading https://files.pythonhosted.org/packages/5f/b9/94e59337107be134b21ce395a29fc0715b707b560108d6797de2d93e1178/gTTS-2.2.2-py3-none-any.whl
Requirement already satisfied, skipping upgrade: click in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (7.1.2)
Requirement already satisfied, skipping upgrade: six in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (1.15.0)
Requirement already satisfied, skipping upgrade: requests in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (2.20.0)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (1.24.3)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (2020.12.5)
Requirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (2.7)
Installing collected packages: gTTS
  Found existing installation: gTTS 2.2.0
    Uninstalling gTTS-2.2.0:
      Successfully uninstalled gTTS-2.2.0
Successfully installed gTTS-2.2.2
```

**Environment:**
 - Device type: Raspberry Pi 4
 - OS: Raspberry OS 64-bit
 - Mycroft-core version: dev



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mycroft/tts/google_tts.py`
Content:
```
1 # Copyright 2017 Mycroft AI Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 from gtts import gTTS
16 from gtts.lang import tts_langs
17 
18 from .tts import TTS, TTSValidator
19 
20 from mycroft.util.log import LOG
21 
22 # Live list of languages
23 # Cached list of supported languages (2020-05-27)
24 _default_langs = {'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic',
25                   'hy': 'Armenian', 'bn': 'Bengali', 'bs': 'Bosnian',
26                   'ca': 'Catalan', 'hr': 'Croatian', 'cs': 'Czech',
27                   'da': 'Danish', 'nl': 'Dutch', 'en': 'English',
28                   'eo': 'Esperanto', 'et': 'Estonian', 'tl': 'Filipino',
29                   'fi': 'Finnish', 'fr': 'French', 'de': 'German',
30                   'el': 'Greek', 'gu': 'Gujarati', 'hi': 'Hindi',
31                   'hu': 'Hungarian', 'is': 'Icelandic', 'id': 'Indonesian',
32                   'it': 'Italian', 'ja': 'Japanese', 'jw': 'Javanese',
33                   'kn': 'Kannada', 'km': 'Khmer', 'ko': 'Korean',
34                   'la': 'Latin', 'lv': 'Latvian', 'mk': 'Macedonian',
35                   'ml': 'Malayalam', 'mr': 'Marathi',
36                   'my': 'Myanmar (Burmese)', 'ne': 'Nepali',
37                   'no': 'Norwegian', 'pl': 'Polish', 'pt': 'Portuguese',
38                   'ro': 'Romanian', 'ru': 'Russian', 'sr': 'Serbian',
39                   'si': 'Sinhala', 'sk': 'Slovak', 'es': 'Spanish',
40                   'su': 'Sundanese', 'sw': 'Swahili', 'sv': 'Swedish',
41                   'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tr': 'Turkish',
42                   'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese',
43                   'cy': 'Welsh', 'zh-cn': 'Chinese (Mandarin/China)',
44                   'zh-tw': 'Chinese (Mandarin/Taiwan)',
45                   'en-us': 'English (US)', 'en-ca': 'English (Canada)',
46                   'en-uk': 'English (UK)', 'en-gb': 'English (UK)',
47                   'en-au': 'English (Australia)', 'en-gh': 'English (Ghana)',
48                   'en-in': 'English (India)', 'en-ie': 'English (Ireland)',
49                   'en-nz': 'English (New Zealand)',
50                   'en-ng': 'English (Nigeria)',
51                   'en-ph': 'English (Philippines)',
52                   'en-za': 'English (South Africa)',
53                   'en-tz': 'English (Tanzania)', 'fr-ca': 'French (Canada)',
54                   'fr-fr': 'French (France)', 'pt-br': 'Portuguese (Brazil)',
55                   'pt-pt': 'Portuguese (Portugal)', 'es-es': 'Spanish (Spain)',
56                   'es-us': 'Spanish (United States)'
57                   }
58 
59 
60 _supported_langs = None
61 
62 
63 def get_supported_langs():
64     """Get dict of supported languages.
65 
66     Tries to fetch remote list, if that fails a local cache will be used.
67 
68     Returns:
69         (dict): Lang code to lang name map.
70     """
71     global _supported_langs
72     if not _supported_langs:
73         try:
74             _supported_langs = tts_langs()
75         except Exception:
76             LOG.warning('Couldn\'t fetch upto date language codes')
77     return _supported_langs or _default_langs
78 
79 
80 class GoogleTTS(TTS):
81     """Interface to google TTS."""
82     def __init__(self, lang, config):
83         self._google_lang = None
84         super(GoogleTTS, self).__init__(lang, config, GoogleTTSValidator(
85             self), 'mp3')
86 
87     @property
88     def google_lang(self):
89         """Property containing a converted language code suitable for gTTS."""
90         supported_langs = get_supported_langs()
91         if not self._google_lang:
92             if self.lang.lower() in supported_langs:
93                 self._google_lang = self.lang.lower()
94             elif self.lang[:2].lower() in supported_langs:
95                 self._google_lang = self.lang[:2]
96         return self._google_lang or self.lang.lower()
97 
98     def get_tts(self, sentence, wav_file):
99         """Fetch tts audio using gTTS.
100 
101         Arguments:
102             sentence (str): Sentence to generate audio for
103             wav_file (str): output file path
104         Returns:
105             Tuple ((str) written file, None)
106         """
107         tts = gTTS(text=sentence, lang=self.google_lang)
108         tts.save(wav_file)
109         return (wav_file, None)  # No phonemes
110 
111 
112 class GoogleTTSValidator(TTSValidator):
113     def __init__(self, tts):
114         super(GoogleTTSValidator, self).__init__(tts)
115 
116     def validate_lang(self):
117         lang = self.tts.google_lang
118         if lang.lower() not in get_supported_langs():
119             raise ValueError("Language not supported by gTTS: {}".format(lang))
120 
121     def validate_connection(self):
122         try:
123             gTTS(text='Hi').save(self.tts.filename)
124         except Exception:
125             raise Exception(
126                 'GoogleTTS server could not be verified. Please check your '
127                 'internet connection.')
128 
129     def get_tts_class(self):
130         return GoogleTTS
131
```
--- 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/mycroft/tts/google_tts.py b/mycroft/tts/google_tts.py
--- a/mycroft/tts/google_tts.py
+++ b/mycroft/tts/google_tts.py
@@ -20,7 +20,7 @@
 from mycroft.util.log import LOG
 
 # Live list of languages
-# Cached list of supported languages (2020-05-27)
+# Cached list of supported languages (2021-02-09)
 _default_langs = {'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic',
                   'hy': 'Armenian', 'bn': 'Bengali', 'bs': 'Bosnian',
                   'ca': 'Catalan', 'hr': 'Croatian', 'cs': 'Czech',
@@ -40,20 +40,7 @@
                   'su': 'Sundanese', 'sw': 'Swahili', 'sv': 'Swedish',
                   'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tr': 'Turkish',
                   'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese',
-                  'cy': 'Welsh', 'zh-cn': 'Chinese (Mandarin/China)',
-                  'zh-tw': 'Chinese (Mandarin/Taiwan)',
-                  'en-us': 'English (US)', 'en-ca': 'English (Canada)',
-                  'en-uk': 'English (UK)', 'en-gb': 'English (UK)',
-                  'en-au': 'English (Australia)', 'en-gh': 'English (Ghana)',
-                  'en-in': 'English (India)', 'en-ie': 'English (Ireland)',
-                  'en-nz': 'English (New Zealand)',
-                  'en-ng': 'English (Nigeria)',
-                  'en-ph': 'English (Philippines)',
-                  'en-za': 'English (South Africa)',
-                  'en-tz': 'English (Tanzania)', 'fr-ca': 'French (Canada)',
-                  'fr-fr': 'French (France)', 'pt-br': 'Portuguese (Brazil)',
-                  'pt-pt': 'Portuguese (Portugal)', 'es-es': 'Spanish (Spain)',
-                  'es-us': 'Spanish (United States)'
+                  'cy': 'Welsh', 'zh': 'Chinese (Mandarin/China)'
                   }

{"golden_diff": "diff --git a/mycroft/tts/google_tts.py b/mycroft/tts/google_tts.py\n--- a/mycroft/tts/google_tts.py\n+++ b/mycroft/tts/google_tts.py\n@@ -20,7 +20,7 @@\n from mycroft.util.log import LOG\n \n # Live list of languages\n-# Cached list of supported languages (2020-05-27)\n+# Cached list of supported languages (2021-02-09)\n _default_langs = {'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic',\n                   'hy': 'Armenian', 'bn': 'Bengali', 'bs': 'Bosnian',\n                   'ca': 'Catalan', 'hr': 'Croatian', 'cs': 'Czech',\n@@ -40,20 +40,7 @@\n                   'su': 'Sundanese', 'sw': 'Swahili', 'sv': 'Swedish',\n                   'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tr': 'Turkish',\n                   'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese',\n-                  'cy': 'Welsh', 'zh-cn': 'Chinese (Mandarin/China)',\n-                  'zh-tw': 'Chinese (Mandarin/Taiwan)',\n-                  'en-us': 'English (US)', 'en-ca': 'English (Canada)',\n-                  'en-uk': 'English (UK)', 'en-gb': 'English (UK)',\n-                  'en-au': 'English (Australia)', 'en-gh': 'English (Ghana)',\n-                  'en-in': 'English (India)', 'en-ie': 'English (Ireland)',\n-                  'en-nz': 'English (New Zealand)',\n-                  'en-ng': 'English (Nigeria)',\n-                  'en-ph': 'English (Philippines)',\n-                  'en-za': 'English (South Africa)',\n-                  'en-tz': 'English (Tanzania)', 'fr-ca': 'French (Canada)',\n-                  'fr-fr': 'French (France)', 'pt-br': 'Portuguese (Brazil)',\n-                  'pt-pt': 'Portuguese (Portugal)', 'es-es': 'Spanish (Spain)',\n-                  'es-us': 'Spanish (United States)'\n+                  'cy': 'Welsh', 'zh': 'Chinese (Mandarin/China)'\n                   }\n", "issue": "gTTS needs to be upgraded to 2.2.2 on dev branch\n**Describe the bug**\r\nWhen using Google TTS, the audio service returns an error and never returns audio.\r\n```\r\n2021-02-06 02:39:24.895 | ERROR    |     1 | mycroft.audio.speech:mute_and_speak:134 | TTS execution failed (gTTSError('200 (OK) from TTS API. Probable cause: Unknown'))\r\n```\r\n\r\nI had to upgrade `gTTS` from `2.2.0` to `2.2.2` to fix the issue.\r\n\r\n```\r\npip install gTTS -U\r\nCollecting gTTS\r\n  Downloading https://files.pythonhosted.org/packages/5f/b9/94e59337107be134b21ce395a29fc0715b707b560108d6797de2d93e1178/gTTS-2.2.2-py3-none-any.whl\r\nRequirement already satisfied, skipping upgrade: click in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (7.1.2)\r\nRequirement already satisfied, skipping upgrade: six in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (1.15.0)\r\nRequirement already satisfied, skipping upgrade: requests in /opt/mycroft-venv/lib/python3.7/site-packages (from gTTS) (2.20.0)\r\nRequirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (1.24.3)\r\nRequirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (3.0.4)\r\nRequirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (2020.12.5)\r\nRequirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /opt/mycroft-venv/lib/python3.7/site-packages (from requests->gTTS) (2.7)\r\nInstalling collected packages: gTTS\r\n  Found existing installation: gTTS 2.2.0\r\n    Uninstalling gTTS-2.2.0:\r\n      Successfully uninstalled gTTS-2.2.0\r\nSuccessfully installed gTTS-2.2.2\r\n```\r\n\r\n**Environment:**\r\n - Device type: Raspberry Pi 4\r\n - OS: Raspberry OS 64-bit\r\n - Mycroft-core version: dev\r\n\r\n\n", "before_files": [{"content": "# Copyright 2017 Mycroft AI Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# 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# limitations under the License.\n#\nfrom gtts import gTTS\nfrom gtts.lang import tts_langs\n\nfrom .tts import TTS, TTSValidator\n\nfrom mycroft.util.log import LOG\n\n# Live list of languages\n# Cached list of supported languages (2020-05-27)\n_default_langs = {'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic',\n                  'hy': 'Armenian', 'bn': 'Bengali', 'bs': 'Bosnian',\n                  'ca': 'Catalan', 'hr': 'Croatian', 'cs': 'Czech',\n                  'da': 'Danish', 'nl': 'Dutch', 'en': 'English',\n                  'eo': 'Esperanto', 'et': 'Estonian', 'tl': 'Filipino',\n                  'fi': 'Finnish', 'fr': 'French', 'de': 'German',\n                  'el': 'Greek', 'gu': 'Gujarati', 'hi': 'Hindi',\n                  'hu': 'Hungarian', 'is': 'Icelandic', 'id': 'Indonesian',\n                  'it': 'Italian', 'ja': 'Japanese', 'jw': 'Javanese',\n                  'kn': 'Kannada', 'km': 'Khmer', 'ko': 'Korean',\n                  'la': 'Latin', 'lv': 'Latvian', 'mk': 'Macedonian',\n                  'ml': 'Malayalam', 'mr': 'Marathi',\n                  'my': 'Myanmar (Burmese)', 'ne': 'Nepali',\n                  'no': 'Norwegian', 'pl': 'Polish', 'pt': 'Portuguese',\n                  'ro': 'Romanian', 'ru': 'Russian', 'sr': 'Serbian',\n                  'si': 'Sinhala', 'sk': 'Slovak', 'es': 'Spanish',\n                  'su': 'Sundanese', 'sw': 'Swahili', 'sv': 'Swedish',\n                  'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tr': 'Turkish',\n                  'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese',\n                  'cy': 'Welsh', 'zh-cn': 'Chinese (Mandarin/China)',\n                  'zh-tw': 'Chinese (Mandarin/Taiwan)',\n                  'en-us': 'English (US)', 'en-ca': 'English (Canada)',\n                  'en-uk': 'English (UK)', 'en-gb': 'English (UK)',\n                  'en-au': 'English (Australia)', 'en-gh': 'English (Ghana)',\n                  'en-in': 'English (India)', 'en-ie': 'English (Ireland)',\n                  'en-nz': 'English (New Zealand)',\n                  'en-ng': 'English (Nigeria)',\n                  'en-ph': 'English (Philippines)',\n                  'en-za': 'English (South Africa)',\n                  'en-tz': 'English (Tanzania)', 'fr-ca': 'French (Canada)',\n                  'fr-fr': 'French (France)', 'pt-br': 'Portuguese (Brazil)',\n                  'pt-pt': 'Portuguese (Portugal)', 'es-es': 'Spanish (Spain)',\n                  'es-us': 'Spanish (United States)'\n                  }\n\n\n_supported_langs = None\n\n\ndef get_supported_langs():\n    \"\"\"Get dict of supported languages.\n\n    Tries to fetch remote list, if that fails a local cache will be used.\n\n    Returns:\n        (dict): Lang code to lang name map.\n    \"\"\"\n    global _supported_langs\n    if not _supported_langs:\n        try:\n            _supported_langs = tts_langs()\n        except Exception:\n            LOG.warning('Couldn\\'t fetch upto date language codes')\n    return _supported_langs or _default_langs\n\n\nclass GoogleTTS(TTS):\n    \"\"\"Interface to google TTS.\"\"\"\n    def __init__(self, lang, config):\n        self._google_lang = None\n        super(GoogleTTS, self).__init__(lang, config, GoogleTTSValidator(\n            self), 'mp3')\n\n    @property\n    def google_lang(self):\n        \"\"\"Property containing a converted language code suitable for gTTS.\"\"\"\n        supported_langs = get_supported_langs()\n        if not self._google_lang:\n            if self.lang.lower() in supported_langs:\n                self._google_lang = self.lang.lower()\n            elif self.lang[:2].lower() in supported_langs:\n                self._google_lang = self.lang[:2]\n        return self._google_lang or self.lang.lower()\n\n    def get_tts(self, sentence, wav_file):\n        \"\"\"Fetch tts audio using gTTS.\n\n        Arguments:\n            sentence (str): Sentence to generate audio for\n            wav_file (str): output file path\n        Returns:\n            Tuple ((str) written file, None)\n        \"\"\"\n        tts = gTTS(text=sentence, lang=self.google_lang)\n        tts.save(wav_file)\n        return (wav_file, None)  # No phonemes\n\n\nclass GoogleTTSValidator(TTSValidator):\n    def __init__(self, tts):\n        super(GoogleTTSValidator, self).__init__(tts)\n\n    def validate_lang(self):\n        lang = self.tts.google_lang\n        if lang.lower() not in get_supported_langs():\n            raise ValueError(\"Language not supported by gTTS: {}\".format(lang))\n\n    def validate_connection(self):\n        try:\n            gTTS(text='Hi').save(self.tts.filename)\n        except Exception:\n            raise Exception(\n                'GoogleTTS server could not be verified. Please check your '\n                'internet connection.')\n\n    def get_tts_class(self):\n        return GoogleTTS\n", "path": "mycroft/tts/google_tts.py"}], "after_files": [{"content": "# Copyright 2017 Mycroft AI Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# 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# limitations under the License.\n#\nfrom gtts import gTTS\nfrom gtts.lang import tts_langs\n\nfrom .tts import TTS, TTSValidator\n\nfrom mycroft.util.log import LOG\n\n# Live list of languages\n# Cached list of supported languages (2021-02-09)\n_default_langs = {'af': 'Afrikaans', 'sq': 'Albanian', 'ar': 'Arabic',\n                  'hy': 'Armenian', 'bn': 'Bengali', 'bs': 'Bosnian',\n                  'ca': 'Catalan', 'hr': 'Croatian', 'cs': 'Czech',\n                  'da': 'Danish', 'nl': 'Dutch', 'en': 'English',\n                  'eo': 'Esperanto', 'et': 'Estonian', 'tl': 'Filipino',\n                  'fi': 'Finnish', 'fr': 'French', 'de': 'German',\n                  'el': 'Greek', 'gu': 'Gujarati', 'hi': 'Hindi',\n                  'hu': 'Hungarian', 'is': 'Icelandic', 'id': 'Indonesian',\n                  'it': 'Italian', 'ja': 'Japanese', 'jw': 'Javanese',\n                  'kn': 'Kannada', 'km': 'Khmer', 'ko': 'Korean',\n                  'la': 'Latin', 'lv': 'Latvian', 'mk': 'Macedonian',\n                  'ml': 'Malayalam', 'mr': 'Marathi',\n                  'my': 'Myanmar (Burmese)', 'ne': 'Nepali',\n                  'no': 'Norwegian', 'pl': 'Polish', 'pt': 'Portuguese',\n                  'ro': 'Romanian', 'ru': 'Russian', 'sr': 'Serbian',\n                  'si': 'Sinhala', 'sk': 'Slovak', 'es': 'Spanish',\n                  'su': 'Sundanese', 'sw': 'Swahili', 'sv': 'Swedish',\n                  'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tr': 'Turkish',\n                  'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese',\n                  'cy': 'Welsh', 'zh': 'Chinese (Mandarin/China)'\n                  }\n\n\n_supported_langs = None\n\n\ndef get_supported_langs():\n    \"\"\"Get dict of supported languages.\n\n    Tries to fetch remote list, if that fails a local cache will be used.\n\n    Returns:\n        (dict): Lang code to lang name map.\n    \"\"\"\n    global _supported_langs\n    if not _supported_langs:\n        try:\n            _supported_langs = tts_langs()\n        except Exception:\n            LOG.warning('Couldn\\'t fetch upto date language codes')\n    return _supported_langs or _default_langs\n\n\nclass GoogleTTS(TTS):\n    \"\"\"Interface to google TTS.\"\"\"\n    def __init__(self, lang, config):\n        self._google_lang = None\n        super(GoogleTTS, self).__init__(lang, config, GoogleTTSValidator(\n            self), 'mp3')\n\n    @property\n    def google_lang(self):\n        \"\"\"Property containing a converted language code suitable for gTTS.\"\"\"\n        supported_langs = get_supported_langs()\n        if not self._google_lang:\n            if self.lang.lower() in supported_langs:\n                self._google_lang = self.lang.lower()\n            elif self.lang[:2].lower() in supported_langs:\n                self._google_lang = self.lang[:2]\n        return self._google_lang or self.lang.lower()\n\n    def get_tts(self, sentence, wav_file):\n        \"\"\"Fetch tts audio using gTTS.\n\n        Arguments:\n            sentence (str): Sentence to generate audio for\n            wav_file (str): output file path\n        Returns:\n            Tuple ((str) written file, None)\n        \"\"\"\n        tts = gTTS(text=sentence, lang=self.google_lang)\n        tts.save(wav_file)\n        return (wav_file, None)  # No phonemes\n\n\nclass GoogleTTSValidator(TTSValidator):\n    def __init__(self, tts):\n        super(GoogleTTSValidator, self).__init__(tts)\n\n    def validate_lang(self):\n        lang = self.tts.google_lang\n        if lang.lower() not in get_supported_langs():\n            raise ValueError(\"Language not supported by gTTS: {}\".format(lang))\n\n    def validate_connection(self):\n        try:\n            gTTS(text='Hi').save(self.tts.filename)\n        except Exception:\n            raise Exception(\n                'GoogleTTS server could not be verified. Please check your '\n                'internet connection.')\n\n    def get_tts_class(self):\n        return GoogleTTS\n", "path": "mycroft/tts/google_tts.py"}]}