We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error KeyError: 'age' - case insensitive in persistentconversationbot.py
There is an error in this:

https://github.com/python-telegram-bot/python-telegram-bot/blob/2cde878d1e5e0bb552aaf41d5ab5df695ec4addb/examples/persistentconversationbot.py#L69

we extract the category using the function "lower", despite the fact that we added without this function:
https://github.com/python-telegram-bot/python-telegram-bot/blob/2cde878d1e5e0bb552aaf41d5ab5df695ec4addb/examples/persistentconversationbot.py#L86-L87
example error:KeyError: 'age'

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/persistentconversationbot.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # This program is dedicated to the public domain under the CC0 license.
4 #
5 # THIS EXAMPLE HAS BEEN UPDATED TO WORK WITH THE BETA VERSION 12 OF PYTHON-TELEGRAM-BOT.
6 # If you're still using version 11.1.0, please see the examples at
7 # https://github.com/python-telegram-bot/python-telegram-bot/tree/v11.1.0/examples
8 
9 """
10 First, a few callback functions are defined. Then, those functions are passed to
11 the Dispatcher and registered at their respective places.
12 Then, the bot is started and runs until we press Ctrl-C on the command line.
13 
14 Usage:
15 Example of a bot-user conversation using ConversationHandler.
16 Send /start to initiate the conversation.
17 Press Ctrl-C on the command line or send a signal to the process to stop the
18 bot.
19 """
20 
21 from telegram import ReplyKeyboardMarkup
22 from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
23                           ConversationHandler, PicklePersistence)
24 
25 import logging
26 
27 # Enable logging
28 logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
29                     level=logging.INFO)
30 
31 logger = logging.getLogger(__name__)
32 
33 CHOOSING, TYPING_REPLY, TYPING_CHOICE = range(3)
34 
35 reply_keyboard = [['Age', 'Favourite colour'],
36                   ['Number of siblings', 'Something else...'],
37                   ['Done']]
38 markup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)
39 
40 
41 def facts_to_str(user_data):
42     facts = list()
43 
44     for key, value in user_data.items():
45         facts.append('{} - {}'.format(key, value))
46 
47     return "\n".join(facts).join(['\n', '\n'])
48 
49 
50 def start(update, context):
51     reply_text = "Hi! My name is Doctor Botter."
52     if context.user_data:
53         reply_text += " You already told me your {}. Why don't you tell me something more " \
54                       "about yourself? Or change enything I " \
55                       "already know.".format(", ".join(context.user_data.keys()))
56     else:
57         reply_text += " I will hold a more complex conversation with you. Why don't you tell me " \
58                       "something about yourself?"
59     update.message.reply_text(reply_text, reply_markup=markup)
60 
61     return CHOOSING
62 
63 
64 def regular_choice(update, context):
65     text = update.message.text
66     context.user_data['choice'] = text
67     if context.user_data.get(text):
68         reply_text = 'Your {}, I already know the following ' \
69                      'about that: {}'.format(text.lower(), context.user_data[text.lower()])
70     else:
71         reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text.lower())
72     update.message.reply_text(reply_text)
73 
74     return TYPING_REPLY
75 
76 
77 def custom_choice(update, context):
78     update.message.reply_text('Alright, please send me the category first, '
79                               'for example "Most impressive skill"')
80 
81     return TYPING_CHOICE
82 
83 
84 def received_information(update, context):
85     text = update.message.text
86     category = context.user_data['choice']
87     context.user_data[category] = text.lower()
88     del context.user_data['choice']
89 
90     update.message.reply_text("Neat! Just so you know, this is what you already told me:"
91                               "{}"
92                               "You can tell me more, or change your opinion on "
93                               "something.".format(facts_to_str(context.user_data)),
94                               reply_markup=markup)
95 
96     return CHOOSING
97 
98 
99 def show_data(update, context):
100     update.message.reply_text("This is what you already told me:"
101                               "{}".format(facts_to_str(context.user_data)))
102 
103 
104 def done(update, context):
105     if 'choice' in context.user_data:
106         del context.user_data['choice']
107 
108     update.message.reply_text("I learned these facts about you:"
109                               "{}"
110                               "Until next time!".format(facts_to_str(context.user_data)))
111     return ConversationHandler.END
112 
113 
114 def error(update, context):
115     """Log Errors caused by Updates."""
116     logger.warning('Update "%s" caused error "%s"', update, error)
117 
118 
119 def main():
120     # Create the Updater and pass it your bot's token.
121     pp = PicklePersistence(filename='conversationbot')
122     updater = Updater("TOKEN", persistence=pp, use_context=True)
123 
124     # Get the dispatcher to register handlers
125     dp = updater.dispatcher
126 
127     # Add conversation handler with the states CHOOSING, TYPING_CHOICE and TYPING_REPLY
128     conv_handler = ConversationHandler(
129         entry_points=[CommandHandler('start', start)],
130 
131         states={
132             CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',
133                                     regular_choice),
134                        RegexHandler('^Something else...$',
135                                     custom_choice),
136                        ],
137 
138             TYPING_CHOICE: [MessageHandler(Filters.text,
139                                            regular_choice),
140                             ],
141 
142             TYPING_REPLY: [MessageHandler(Filters.text,
143                                           received_information),
144                            ],
145         },
146 
147         fallbacks=[RegexHandler('^Done$', done)],
148         name="my_conversation",
149         persistent=True
150     )
151 
152     dp.add_handler(conv_handler)
153 
154     show_data_handler = CommandHandler('show_data', show_data)
155     dp.add_handler(show_data_handler)
156     # log all errors
157     dp.add_error_handler(error)
158 
159     # Start the Bot
160     updater.start_polling()
161 
162     # Run the bot until you press Ctrl-C or the process receives SIGINT,
163     # SIGTERM or SIGABRT. This should be used most of the time, since
164     # start_polling() is non-blocking and will stop the bot gracefully.
165     updater.idle()
166 
167 
168 if __name__ == '__main__':
169     main()
170
```
--- 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/examples/persistentconversationbot.py b/examples/persistentconversationbot.py
--- a/examples/persistentconversationbot.py
+++ b/examples/persistentconversationbot.py
@@ -62,13 +62,13 @@
 
 
 def regular_choice(update, context):
-    text = update.message.text
+    text = update.message.text.lower()
     context.user_data['choice'] = text
     if context.user_data.get(text):
         reply_text = 'Your {}, I already know the following ' \
-                     'about that: {}'.format(text.lower(), context.user_data[text.lower()])
+                     'about that: {}'.format(text, context.user_data[text])
     else:
-        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text.lower())
+        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text)
     update.message.reply_text(reply_text)
 
     return TYPING_REPLY

{"golden_diff": "diff --git a/examples/persistentconversationbot.py b/examples/persistentconversationbot.py\n--- a/examples/persistentconversationbot.py\n+++ b/examples/persistentconversationbot.py\n@@ -62,13 +62,13 @@\n \n \n def regular_choice(update, context):\n-    text = update.message.text\n+    text = update.message.text.lower()\n     context.user_data['choice'] = text\n     if context.user_data.get(text):\n         reply_text = 'Your {}, I already know the following ' \\\n-                     'about that: {}'.format(text.lower(), context.user_data[text.lower()])\n+                     'about that: {}'.format(text, context.user_data[text])\n     else:\n-        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text.lower())\n+        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text)\n     update.message.reply_text(reply_text)\n \n     return TYPING_REPLY\n", "issue": "Error KeyError: 'age' - case insensitive in persistentconversationbot.py\nThere is an error in this:\r\n\r\nhttps://github.com/python-telegram-bot/python-telegram-bot/blob/2cde878d1e5e0bb552aaf41d5ab5df695ec4addb/examples/persistentconversationbot.py#L69\r\n\r\nwe extract the category using the function \"lower\", despite the fact that we added without this function:\r\nhttps://github.com/python-telegram-bot/python-telegram-bot/blob/2cde878d1e5e0bb552aaf41d5ab5df695ec4addb/examples/persistentconversationbot.py#L86-L87\r\nexample error:KeyError: 'age'\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# This program is dedicated to the public domain under the CC0 license.\n#\n# THIS EXAMPLE HAS BEEN UPDATED TO WORK WITH THE BETA VERSION 12 OF PYTHON-TELEGRAM-BOT.\n# If you're still using version 11.1.0, please see the examples at\n# https://github.com/python-telegram-bot/python-telegram-bot/tree/v11.1.0/examples\n\n\"\"\"\nFirst, a few callback functions are defined. Then, those functions are passed to\nthe Dispatcher and registered at their respective places.\nThen, the bot is started and runs until we press Ctrl-C on the command line.\n\nUsage:\nExample of a bot-user conversation using ConversationHandler.\nSend /start to initiate the conversation.\nPress Ctrl-C on the command line or send a signal to the process to stop the\nbot.\n\"\"\"\n\nfrom telegram import ReplyKeyboardMarkup\nfrom telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,\n                          ConversationHandler, PicklePersistence)\n\nimport logging\n\n# Enable logging\nlogging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n                    level=logging.INFO)\n\nlogger = logging.getLogger(__name__)\n\nCHOOSING, TYPING_REPLY, TYPING_CHOICE = range(3)\n\nreply_keyboard = [['Age', 'Favourite colour'],\n                  ['Number of siblings', 'Something else...'],\n                  ['Done']]\nmarkup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)\n\n\ndef facts_to_str(user_data):\n    facts = list()\n\n    for key, value in user_data.items():\n        facts.append('{} - {}'.format(key, value))\n\n    return \"\\n\".join(facts).join(['\\n', '\\n'])\n\n\ndef start(update, context):\n    reply_text = \"Hi! My name is Doctor Botter.\"\n    if context.user_data:\n        reply_text += \" You already told me your {}. Why don't you tell me something more \" \\\n                      \"about yourself? Or change enything I \" \\\n                      \"already know.\".format(\", \".join(context.user_data.keys()))\n    else:\n        reply_text += \" I will hold a more complex conversation with you. Why don't you tell me \" \\\n                      \"something about yourself?\"\n    update.message.reply_text(reply_text, reply_markup=markup)\n\n    return CHOOSING\n\n\ndef regular_choice(update, context):\n    text = update.message.text\n    context.user_data['choice'] = text\n    if context.user_data.get(text):\n        reply_text = 'Your {}, I already know the following ' \\\n                     'about that: {}'.format(text.lower(), context.user_data[text.lower()])\n    else:\n        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text.lower())\n    update.message.reply_text(reply_text)\n\n    return TYPING_REPLY\n\n\ndef custom_choice(update, context):\n    update.message.reply_text('Alright, please send me the category first, '\n                              'for example \"Most impressive skill\"')\n\n    return TYPING_CHOICE\n\n\ndef received_information(update, context):\n    text = update.message.text\n    category = context.user_data['choice']\n    context.user_data[category] = text.lower()\n    del context.user_data['choice']\n\n    update.message.reply_text(\"Neat! Just so you know, this is what you already told me:\"\n                              \"{}\"\n                              \"You can tell me more, or change your opinion on \"\n                              \"something.\".format(facts_to_str(context.user_data)),\n                              reply_markup=markup)\n\n    return CHOOSING\n\n\ndef show_data(update, context):\n    update.message.reply_text(\"This is what you already told me:\"\n                              \"{}\".format(facts_to_str(context.user_data)))\n\n\ndef done(update, context):\n    if 'choice' in context.user_data:\n        del context.user_data['choice']\n\n    update.message.reply_text(\"I learned these facts about you:\"\n                              \"{}\"\n                              \"Until next time!\".format(facts_to_str(context.user_data)))\n    return ConversationHandler.END\n\n\ndef error(update, context):\n    \"\"\"Log Errors caused by Updates.\"\"\"\n    logger.warning('Update \"%s\" caused error \"%s\"', update, error)\n\n\ndef main():\n    # Create the Updater and pass it your bot's token.\n    pp = PicklePersistence(filename='conversationbot')\n    updater = Updater(\"TOKEN\", persistence=pp, use_context=True)\n\n    # Get the dispatcher to register handlers\n    dp = updater.dispatcher\n\n    # Add conversation handler with the states CHOOSING, TYPING_CHOICE and TYPING_REPLY\n    conv_handler = ConversationHandler(\n        entry_points=[CommandHandler('start', start)],\n\n        states={\n            CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',\n                                    regular_choice),\n                       RegexHandler('^Something else...$',\n                                    custom_choice),\n                       ],\n\n            TYPING_CHOICE: [MessageHandler(Filters.text,\n                                           regular_choice),\n                            ],\n\n            TYPING_REPLY: [MessageHandler(Filters.text,\n                                          received_information),\n                           ],\n        },\n\n        fallbacks=[RegexHandler('^Done$', done)],\n        name=\"my_conversation\",\n        persistent=True\n    )\n\n    dp.add_handler(conv_handler)\n\n    show_data_handler = CommandHandler('show_data', show_data)\n    dp.add_handler(show_data_handler)\n    # log all errors\n    dp.add_error_handler(error)\n\n    # Start the Bot\n    updater.start_polling()\n\n    # Run the bot until you press Ctrl-C or the process receives SIGINT,\n    # SIGTERM or SIGABRT. This should be used most of the time, since\n    # start_polling() is non-blocking and will stop the bot gracefully.\n    updater.idle()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "examples/persistentconversationbot.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# This program is dedicated to the public domain under the CC0 license.\n#\n# THIS EXAMPLE HAS BEEN UPDATED TO WORK WITH THE BETA VERSION 12 OF PYTHON-TELEGRAM-BOT.\n# If you're still using version 11.1.0, please see the examples at\n# https://github.com/python-telegram-bot/python-telegram-bot/tree/v11.1.0/examples\n\n\"\"\"\nFirst, a few callback functions are defined. Then, those functions are passed to\nthe Dispatcher and registered at their respective places.\nThen, the bot is started and runs until we press Ctrl-C on the command line.\n\nUsage:\nExample of a bot-user conversation using ConversationHandler.\nSend /start to initiate the conversation.\nPress Ctrl-C on the command line or send a signal to the process to stop the\nbot.\n\"\"\"\n\nfrom telegram import ReplyKeyboardMarkup\nfrom telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,\n                          ConversationHandler, PicklePersistence)\n\nimport logging\n\n# Enable logging\nlogging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n                    level=logging.INFO)\n\nlogger = logging.getLogger(__name__)\n\nCHOOSING, TYPING_REPLY, TYPING_CHOICE = range(3)\n\nreply_keyboard = [['Age', 'Favourite colour'],\n                  ['Number of siblings', 'Something else...'],\n                  ['Done']]\nmarkup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)\n\n\ndef facts_to_str(user_data):\n    facts = list()\n\n    for key, value in user_data.items():\n        facts.append('{} - {}'.format(key, value))\n\n    return \"\\n\".join(facts).join(['\\n', '\\n'])\n\n\ndef start(update, context):\n    reply_text = \"Hi! My name is Doctor Botter.\"\n    if context.user_data:\n        reply_text += \" You already told me your {}. Why don't you tell me something more \" \\\n                      \"about yourself? Or change enything I \" \\\n                      \"already know.\".format(\", \".join(context.user_data.keys()))\n    else:\n        reply_text += \" I will hold a more complex conversation with you. Why don't you tell me \" \\\n                      \"something about yourself?\"\n    update.message.reply_text(reply_text, reply_markup=markup)\n\n    return CHOOSING\n\n\ndef regular_choice(update, context):\n    text = update.message.text.lower()\n    context.user_data['choice'] = text\n    if context.user_data.get(text):\n        reply_text = 'Your {}, I already know the following ' \\\n                     'about that: {}'.format(text, context.user_data[text])\n    else:\n        reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text)\n    update.message.reply_text(reply_text)\n\n    return TYPING_REPLY\n\n\ndef custom_choice(update, context):\n    update.message.reply_text('Alright, please send me the category first, '\n                              'for example \"Most impressive skill\"')\n\n    return TYPING_CHOICE\n\n\ndef received_information(update, context):\n    text = update.message.text\n    category = context.user_data['choice']\n    context.user_data[category] = text.lower()\n    del context.user_data['choice']\n\n    update.message.reply_text(\"Neat! Just so you know, this is what you already told me:\"\n                              \"{}\"\n                              \"You can tell me more, or change your opinion on \"\n                              \"something.\".format(facts_to_str(context.user_data)),\n                              reply_markup=markup)\n\n    return CHOOSING\n\n\ndef show_data(update, context):\n    update.message.reply_text(\"This is what you already told me:\"\n                              \"{}\".format(facts_to_str(context.user_data)))\n\n\ndef done(update, context):\n    if 'choice' in context.user_data:\n        del context.user_data['choice']\n\n    update.message.reply_text(\"I learned these facts about you:\"\n                              \"{}\"\n                              \"Until next time!\".format(facts_to_str(context.user_data)))\n    return ConversationHandler.END\n\n\ndef error(update, context):\n    \"\"\"Log Errors caused by Updates.\"\"\"\n    logger.warning('Update \"%s\" caused error \"%s\"', update, error)\n\n\ndef main():\n    # Create the Updater and pass it your bot's token.\n    pp = PicklePersistence(filename='conversationbot')\n    updater = Updater(\"TOKEN\", persistence=pp, use_context=True)\n\n    # Get the dispatcher to register handlers\n    dp = updater.dispatcher\n\n    # Add conversation handler with the states CHOOSING, TYPING_CHOICE and TYPING_REPLY\n    conv_handler = ConversationHandler(\n        entry_points=[CommandHandler('start', start)],\n\n        states={\n            CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',\n                                    regular_choice),\n                       RegexHandler('^Something else...$',\n                                    custom_choice),\n                       ],\n\n            TYPING_CHOICE: [MessageHandler(Filters.text,\n                                           regular_choice),\n                            ],\n\n            TYPING_REPLY: [MessageHandler(Filters.text,\n                                          received_information),\n                           ],\n        },\n\n        fallbacks=[RegexHandler('^Done$', done)],\n        name=\"my_conversation\",\n        persistent=True\n    )\n\n    dp.add_handler(conv_handler)\n\n    show_data_handler = CommandHandler('show_data', show_data)\n    dp.add_handler(show_data_handler)\n    # log all errors\n    dp.add_error_handler(error)\n\n    # Start the Bot\n    updater.start_polling()\n\n    # Run the bot until you press Ctrl-C or the process receives SIGINT,\n    # SIGTERM or SIGABRT. This should be used most of the time, since\n    # start_polling() is non-blocking and will stop the bot gracefully.\n    updater.idle()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "examples/persistentconversationbot.py"}]}