prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Idea: Enhance Amazon Polly support
  Amazon Polly works well using standard voices, I have it running perfectly under the latest Picroft image. However, there is no current support for 'neural' engine voices, as well as 'conversational' style SSML. Both of these provide exceptionally high quality text-to-speech audio and would be nice to have the ability to use with Mycroft.
  
  This [post](https://community.mycroft.ai/t/regarding-polly-tts-support/8722/10) on the community forums goes in to a little more detail on it.
  
  Thanks!
  
  --- 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/polly_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 mycroft.tts.tts import TTS, TTSValidator
  16 from mycroft.configuration import Configuration
  17 
  18 
  19 class PollyTTS(TTS):
  20     def __init__(self, lang="en-us", config=None):
  21         import boto3
  22         config = config or Configuration.get().get("tts", {}).get("polly", {})
  23         super(PollyTTS, self).__init__(lang, config, PollyTTSValidator(self),
  24                                        audio_ext="mp3",
  25                                        ssml_tags=["speak", "say-as", "voice",
  26                                                   "prosody", "break",
  27                                                   "emphasis", "sub", "lang",
  28                                                   "phoneme", "w", "whisper",
  29                                                   "amazon:auto-breaths",
  30                                                   "p", "s", "amazon:effect",
  31                                                   "mark"])
  32 
  33         self.voice = self.config.get("voice", "Matthew")
  34         self.key_id = self.config.get("access_key_id", '')
  35         self.key = self.config.get("secret_access_key", '')
  36         self.region = self.config.get("region", 'us-east-1')
  37         self.polly = boto3.Session(aws_access_key_id=self.key_id,
  38                                    aws_secret_access_key=self.key,
  39                                    region_name=self.region).client('polly')
  40 
  41     def get_tts(self, sentence, wav_file):
  42         text_type = "text"
  43         if self.remove_ssml(sentence) != sentence:
  44             text_type = "ssml"
  45             sentence = sentence \
  46                 .replace("\\whispered", "/amazon:effect") \
  47                 .replace("whispered", "amazon:effect name=\"whispered\"")
  48         response = self.polly.synthesize_speech(
  49             OutputFormat=self.audio_ext,
  50             Text=sentence,
  51             TextType=text_type,
  52             VoiceId=self.voice)
  53 
  54         with open(wav_file, 'wb') as f:
  55             f.write(response['AudioStream'].read())
  56         return (wav_file, None)  # No phonemes
  57 
  58     def describe_voices(self, language_code="en-US"):
  59         if language_code.islower():
  60             a, b = language_code.split("-")
  61             b = b.upper()
  62             language_code = "-".join([a, b])
  63         # example 'it-IT' useful to retrieve voices
  64         voices = self.polly.describe_voices(LanguageCode=language_code)
  65 
  66         return voices
  67 
  68 
  69 class PollyTTSValidator(TTSValidator):
  70     def __init__(self, tts):
  71         super(PollyTTSValidator, self).__init__(tts)
  72 
  73     def validate_lang(self):
  74         # TODO
  75         pass
  76 
  77     def validate_dependencies(self):
  78         try:
  79             from boto3 import Session
  80         except ImportError:
  81             raise Exception(
  82                 'PollyTTS dependencies not installed, please run pip install '
  83                 'boto3 ')
  84 
  85     def validate_connection(self):
  86         try:
  87             if not self.tts.voice:
  88                 raise Exception("Polly TTS Voice not configured")
  89             output = self.tts.describe_voices()
  90         except TypeError:
  91             raise Exception(
  92                 'PollyTTS server could not be verified. Please check your '
  93                 'internet connection and credentials.')
  94 
  95     def get_tts_class(self):
  96         return PollyTTS
  97
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/mycroft/tts/polly_tts.py b/mycroft/tts/polly_tts.py
  --- a/mycroft/tts/polly_tts.py
  +++ b/mycroft/tts/polly_tts.py
  @@ -34,6 +34,7 @@
           self.key_id = self.config.get("access_key_id", '')
           self.key = self.config.get("secret_access_key", '')
           self.region = self.config.get("region", 'us-east-1')
  +        self.engine = self.config.get("engine", "standard")
           self.polly = boto3.Session(aws_access_key_id=self.key_id,
                                      aws_secret_access_key=self.key,
                                      region_name=self.region).client('polly')
  @@ -49,7 +50,8 @@
               OutputFormat=self.audio_ext,
               Text=sentence,
               TextType=text_type,
  -            VoiceId=self.voice)
  +            VoiceId=self.voice,
  +            Engine=self.engine)
   
           with open(wav_file, 'wb') as f:
               f.write(response['AudioStream'].read())
  
verification_info: {"golden_diff": "diff --git a/mycroft/tts/polly_tts.py b/mycroft/tts/polly_tts.py\n--- a/mycroft/tts/polly_tts.py\n+++ b/mycroft/tts/polly_tts.py\n@@ -34,6 +34,7 @@\n         self.key_id = self.config.get(\"access_key_id\", '')\n         self.key = self.config.get(\"secret_access_key\", '')\n         self.region = self.config.get(\"region\", 'us-east-1')\n+        self.engine = self.config.get(\"engine\", \"standard\")\n         self.polly = boto3.Session(aws_access_key_id=self.key_id,\n                                    aws_secret_access_key=self.key,\n                                    region_name=self.region).client('polly')\n@@ -49,7 +50,8 @@\n             OutputFormat=self.audio_ext,\n             Text=sentence,\n             TextType=text_type,\n-            VoiceId=self.voice)\n+            VoiceId=self.voice,\n+            Engine=self.engine)\n \n         with open(wav_file, 'wb') as f:\n             f.write(response['AudioStream'].read())\n", "issue": "Idea: Enhance Amazon Polly support\nAmazon Polly works well using standard voices, I have it running perfectly under the latest Picroft image. However, there is no current support for 'neural' engine voices, as well as 'conversational' style SSML. Both of these provide exceptionally high quality text-to-speech audio and would be nice to have the ability to use with Mycroft.\r\n\r\nThis [post](https://community.mycroft.ai/t/regarding-polly-tts-support/8722/10) on the community forums goes in to a little more detail on it.\r\n\r\nThanks!\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 mycroft.tts.tts import TTS, TTSValidator\nfrom mycroft.configuration import Configuration\n\n\nclass PollyTTS(TTS):\n    def __init__(self, lang=\"en-us\", config=None):\n        import boto3\n        config = config or Configuration.get().get(\"tts\", {}).get(\"polly\", {})\n        super(PollyTTS, self).__init__(lang, config, PollyTTSValidator(self),\n                                       audio_ext=\"mp3\",\n                                       ssml_tags=[\"speak\", \"say-as\", \"voice\",\n                                                  \"prosody\", \"break\",\n                                                  \"emphasis\", \"sub\", \"lang\",\n                                                  \"phoneme\", \"w\", \"whisper\",\n                                                  \"amazon:auto-breaths\",\n                                                  \"p\", \"s\", \"amazon:effect\",\n                                                  \"mark\"])\n\n        self.voice = self.config.get(\"voice\", \"Matthew\")\n        self.key_id = self.config.get(\"access_key_id\", '')\n        self.key = self.config.get(\"secret_access_key\", '')\n        self.region = self.config.get(\"region\", 'us-east-1')\n        self.polly = boto3.Session(aws_access_key_id=self.key_id,\n                                   aws_secret_access_key=self.key,\n                                   region_name=self.region).client('polly')\n\n    def get_tts(self, sentence, wav_file):\n        text_type = \"text\"\n        if self.remove_ssml(sentence) != sentence:\n            text_type = \"ssml\"\n            sentence = sentence \\\n                .replace(\"\\\\whispered\", \"/amazon:effect\") \\\n                .replace(\"whispered\", \"amazon:effect name=\\\"whispered\\\"\")\n        response = self.polly.synthesize_speech(\n            OutputFormat=self.audio_ext,\n            Text=sentence,\n            TextType=text_type,\n            VoiceId=self.voice)\n\n        with open(wav_file, 'wb') as f:\n            f.write(response['AudioStream'].read())\n        return (wav_file, None)  # No phonemes\n\n    def describe_voices(self, language_code=\"en-US\"):\n        if language_code.islower():\n            a, b = language_code.split(\"-\")\n            b = b.upper()\n            language_code = \"-\".join([a, b])\n        # example 'it-IT' useful to retrieve voices\n        voices = self.polly.describe_voices(LanguageCode=language_code)\n\n        return voices\n\n\nclass PollyTTSValidator(TTSValidator):\n    def __init__(self, tts):\n        super(PollyTTSValidator, self).__init__(tts)\n\n    def validate_lang(self):\n        # TODO\n        pass\n\n    def validate_dependencies(self):\n        try:\n            from boto3 import Session\n        except ImportError:\n            raise Exception(\n                'PollyTTS dependencies not installed, please run pip install '\n                'boto3 ')\n\n    def validate_connection(self):\n        try:\n            if not self.tts.voice:\n                raise Exception(\"Polly TTS Voice not configured\")\n            output = self.tts.describe_voices()\n        except TypeError:\n            raise Exception(\n                'PollyTTS server could not be verified. Please check your '\n                'internet connection and credentials.')\n\n    def get_tts_class(self):\n        return PollyTTS\n", "path": "mycroft/tts/polly_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 mycroft.tts.tts import TTS, TTSValidator\nfrom mycroft.configuration import Configuration\n\n\nclass PollyTTS(TTS):\n    def __init__(self, lang=\"en-us\", config=None):\n        import boto3\n        config = config or Configuration.get().get(\"tts\", {}).get(\"polly\", {})\n        super(PollyTTS, self).__init__(lang, config, PollyTTSValidator(self),\n                                       audio_ext=\"mp3\",\n                                       ssml_tags=[\"speak\", \"say-as\", \"voice\",\n                                                  \"prosody\", \"break\",\n                                                  \"emphasis\", \"sub\", \"lang\",\n                                                  \"phoneme\", \"w\", \"whisper\",\n                                                  \"amazon:auto-breaths\",\n                                                  \"p\", \"s\", \"amazon:effect\",\n                                                  \"mark\"])\n\n        self.voice = self.config.get(\"voice\", \"Matthew\")\n        self.key_id = self.config.get(\"access_key_id\", '')\n        self.key = self.config.get(\"secret_access_key\", '')\n        self.region = self.config.get(\"region\", 'us-east-1')\n        self.engine = self.config.get(\"engine\", \"standard\")\n        self.polly = boto3.Session(aws_access_key_id=self.key_id,\n                                   aws_secret_access_key=self.key,\n                                   region_name=self.region).client('polly')\n\n    def get_tts(self, sentence, wav_file):\n        text_type = \"text\"\n        if self.remove_ssml(sentence) != sentence:\n            text_type = \"ssml\"\n            sentence = sentence \\\n                .replace(\"\\\\whispered\", \"/amazon:effect\") \\\n                .replace(\"whispered\", \"amazon:effect name=\\\"whispered\\\"\")\n        response = self.polly.synthesize_speech(\n            OutputFormat=self.audio_ext,\n            Text=sentence,\n            TextType=text_type,\n            VoiceId=self.voice,\n            Engine=self.engine)\n\n        with open(wav_file, 'wb') as f:\n            f.write(response['AudioStream'].read())\n        return (wav_file, None)  # No phonemes\n\n    def describe_voices(self, language_code=\"en-US\"):\n        if language_code.islower():\n            a, b = language_code.split(\"-\")\n            b = b.upper()\n            language_code = \"-\".join([a, b])\n        # example 'it-IT' useful to retrieve voices\n        voices = self.polly.describe_voices(LanguageCode=language_code)\n\n        return voices\n\n\nclass PollyTTSValidator(TTSValidator):\n    def __init__(self, tts):\n        super(PollyTTSValidator, self).__init__(tts)\n\n    def validate_lang(self):\n        # TODO\n        pass\n\n    def validate_dependencies(self):\n        try:\n            from boto3 import Session\n        except ImportError:\n            raise Exception(\n                'PollyTTS dependencies not installed, please run pip install '\n                'boto3 ')\n\n    def validate_connection(self):\n        try:\n            if not self.tts.voice:\n                raise Exception(\"Polly TTS Voice not configured\")\n            output = self.tts.describe_voices()\n        except TypeError:\n            raise Exception(\n                'PollyTTS server could not be verified. Please check your '\n                'internet connection and credentials.')\n\n    def get_tts_class(self):\n        return PollyTTS\n", "path": "mycroft/tts/polly_tts.py"}]}