We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Assign to Team after reaching lvl 5
<!-- ===============FEATURE REQUEST SECTION===============

Before you create a Feature Request, please check the following:

1. Have you [searched our feature tracker](https://github.com/PokemonGoF/PokemonGo-Bot/labels/Feature%20Request) first to ensure someone else hasn't already come up with the same great idea.  If so then be sure to +1 it 
2. While you're there, be sure to vote on other feature requests to let the devs know what is important to you.
-->

<!-- Note: Delete this line and everything ABOVE if creating a Feature Request -->
### Short Description

<!-- Tell us a short description of your request -->

Add the ability to assign to a team (blue, red, yellow) after bot is reaching lvl5

<!-- ==========END OF FEATURE REQUEST SECTION========== -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pokemongo_bot/cell_workers/complete_tutorial.py`
Content:
```
1 import random
2 
3 from pokemongo_bot import logger
4 from pokemongo_bot.base_task import BaseTask
5 from pokemongo_bot.worker_result import WorkerResult
6 from pokemongo_bot.human_behaviour import sleep
7 
8 
9 
10 class CompleteTutorial(BaseTask):
11 
12     SUPPORTED_TASK_API_VERSION = 1
13 
14     def initialize(self):
15         self.api = self.bot.api
16         self.nickname = self.config.get('nickname','')
17         self.team = self.config.get('team',0)
18         self.may_run = True
19 
20     def should_run(self):
21         return self.may_run
22 
23     def work(self):
24 
25         if not self.should_run():
26             return WorkerResult.SUCCESS
27 
28         # Only execute the worker once to avoid error loop
29         self.may_run = False
30 
31         if self._check_tutorial_state():
32             return WorkerResult.SUCCESS
33         else:
34             return WorkerResult.ERROR
35 
36     def _check_tutorial_state(self):
37         self._player=self.bot.player_data
38 
39         tutorial_state = self._player.get('tutorial_state', [])
40         # LEGAL_SCREEN = 0
41         if not 0 in tutorial_state:
42             sleep(2)
43             if self._set_tutorial_state(0):
44                 self.logger.info('Completed legal screen')
45                 tutorial_state = self._player.get('tutorial_state', [])
46             else:
47                 return False
48 
49         # AVATAR_SELECTION = 1
50         if not 1 in tutorial_state:
51             sleep(7)
52             if self._set_avatar():
53                 if self._set_tutorial_state(1):
54                     self.logger.info('Completed avatar selection')
55                     tutorial_state = self._player.get('tutorial_state', [])
56                 else:
57                     return False
58             else:
59                 self.logger.error('Error during avatar selection')
60                 return False
61 
62         # POKEMON_CAPTURE = 3
63         if not 3 in tutorial_state:
64             sleep(10)
65             if self._encounter_tutorial():
66                 self.logger.info('Completed first capture')
67             else:
68                 self.logger.error('Error during first capture')
69                 return False
70 
71         # NAME_SELECTION = 4
72         if not 4 in tutorial_state:
73             if not self.nickname:
74                 self.logger.info("No nickname defined in config")
75                 return False
76 
77             self.logger.info(u'Trying to set {} as nickname'.format(self.nickname))
78             sleep(5)
79             if self._set_nickname(self.nickname):
80                 self._set_tutorial_state(4)
81                 tutorial_state = self._player.get('tutorial_state', [])
82             else:
83                 self.logger.error('Error trying to set nickname')
84                 return False
85 
86         # FIRST_TIME_EXPERIENCE_COMPLETE = 7
87         if not 7 in tutorial_state:
88             if self._set_tutorial_state(7):
89                 self.logger.info('Completed first time experience')
90             else:
91                 return False
92 
93         return True
94 
95     def _encounter_tutorial(self):
96         # You just need to call the API with the pokemon you choose
97         # Probably can't get MewTwo as first pokemon though
98         first_pokemon_id = random.choice([1, 4, 7])
99         response_dict = self.api.encounter_tutorial_complete(
100             pokemon_id=first_pokemon_id)
101         try:
102             if response_dict['responses']['ENCOUNTER_TUTORIAL_COMPLETE']['result'] == 1:
103                 return True
104             else:
105                 self.logger.error("Error during encouter tutorial")
106                 return False
107         except KeyError:
108             self.logger.error("KeyError during encouter tutorial")
109             return False
110 
111     def _random_avatar(self):
112         avatar= {}
113         # 0 = Male, 1 = Female
114         avatar['gender']=random.randint(0,1)
115         # What is the max value of each parameter ?
116         # Default is 0, anyway human player will stop
117         # at the first choices in general, so fully
118         # random on the whole avatar space is not the way to go either
119         avatar['skin']=random.randint(0,3)
120         avatar['hair']=random.randint(0,3)
121         avatar['shirt']=random.randint(0,3)
122         avatar['pants']=random.randint(0,3)
123         avatar['hat']=random.randint(0,3)
124         avatar['shoes']=random.randint(0,3)
125         avatar['eyes']=random.randint(0,3)
126         avatar['backpack']=random.randint(0,3)
127         return avatar
128 
129     def _set_avatar(self):
130         avatar = self._random_avatar()
131         response_dict = self.api.set_avatar(player_avatar=avatar)
132         status = response_dict['responses']['SET_AVATAR']['status']
133         try:
134             if status == 1:
135                 return True
136             else:
137                 error_codes = {
138                     0: 'UNSET',
139                     1: 'SUCCESS',
140                     2: 'AVATAR_ALREADY_SET',
141                     3: 'FAILURE',
142                 }
143                 self.logger.error("Error during avatar selection : {}".format(error_codes[status]))
144                 return False
145         except KeyError:
146             self.logger.error("KeyError during avatar selection")
147             return False
148 
149     def _set_nickname(self, nickname):
150         response_dict = self.api.claim_codename(codename=nickname)
151         try:
152             result = response_dict['responses']['CLAIM_CODENAME']['status']
153             if result == 1:
154                 self.logger.info(u'Name changed to {}'.format(nickname))
155                 return True
156             else:
157                 # Would be nice to get the text directly from the proto Enum
158                 error_codes = {
159                     0: 'UNSET',
160                     1: 'SUCCESS',
161                     2: 'CODENAME_NOT_AVAILABLE',
162                     3: 'CODENAME_NOT_VALID',
163                     4: 'CURRENT_OWNER',
164                     5: 'CODENAME_CHANGE_NOT_ALLOWED'
165                 }
166                 self.logger.error(
167                     u'Error while changing nickname : {}'.format(error_codes[result]))
168                 return False
169         except KeyError:
170             return False
171 
172     def _set_tutorial_state(self, completed):
173         response_dict = self.api.mark_tutorial_complete(tutorials_completed=[
174                                                         completed], send_marketing_emails=False, send_push_notifications=False)
175         try:
176             self._player = response_dict['responses'][
177                 'MARK_TUTORIAL_COMPLETE']['player_data']
178             return response_dict['responses']['MARK_TUTORIAL_COMPLETE']['success']
179         except KeyError:
180             self.logger.error("KeyError while setting tutorial state")
181             return False
182
```
--- 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/pokemongo_bot/cell_workers/complete_tutorial.py b/pokemongo_bot/cell_workers/complete_tutorial.py
--- a/pokemongo_bot/cell_workers/complete_tutorial.py
+++ b/pokemongo_bot/cell_workers/complete_tutorial.py
@@ -1,6 +1,7 @@
 import random
 
 from pokemongo_bot import logger
+from pokemongo_bot.inventory import player
 from pokemongo_bot.base_task import BaseTask
 from pokemongo_bot.worker_result import WorkerResult
 from pokemongo_bot.human_behaviour import sleep
@@ -15,23 +16,22 @@
         self.api = self.bot.api
         self.nickname = self.config.get('nickname','')
         self.team = self.config.get('team',0)
-        self.may_run = True
-
-    def should_run(self):
-        return self.may_run
+        self.tutorial_run = True
+        self.team_run = True
 
     def work(self):
 
-        if not self.should_run():
-            return WorkerResult.SUCCESS
+        if self.tutorial_run:
+            self.tutorial_run = False
+            if not self._check_tutorial_state():
+                return WorkerResult.ERROR
 
-        # Only execute the worker once to avoid error loop
-        self.may_run = False
+        if self.team_run and player()._level >= 5:
+            self.team_run = False
+            if not self._set_team():
+                return WorkerResult.ERROR
 
-        if self._check_tutorial_state():
-            return WorkerResult.SUCCESS
-        else:
-            return WorkerResult.ERROR
+        return WorkerResult.SUCCESS
 
     def _check_tutorial_state(self):
         self._player=self.bot.player_data
@@ -179,3 +179,36 @@
         except KeyError:
             self.logger.error("KeyError while setting tutorial state")
             return False
+
+    def _set_team(self):
+        if self.team == 0:
+            return True
+
+        if self.bot.player_data.get('team', 0) != 0:
+            self.logger.info(u'Team already picked')
+            return True
+
+        sleep(10)
+        response_dict = self.api.set_player_team(team=self.team)
+        try:
+            result = response_dict['responses']['SET_PLAYER_TEAM']['status']
+            if result == 1:
+                team_codes = {
+                    1: 'Mystic (BLUE)',
+                    2: 'Valor (RED)',
+                    3: 'Instinct (YELLOW)'
+                }
+                self.logger.info(u'Picked Team {}.'.format(team_codes[self.team]))
+                return True
+            else:
+                error_codes = {
+                    0: 'UNSET',
+                    1: 'SUCCESS',
+                    2: 'TEAM_ALREADY_SET',
+                    3: 'FAILURE'
+                }
+                self.logger.error(u'Error while picking team : {}'.format(error_codes[result]))
+                return False
+        except KeyError:
+            return False
+

{"golden_diff": "diff --git a/pokemongo_bot/cell_workers/complete_tutorial.py b/pokemongo_bot/cell_workers/complete_tutorial.py\n--- a/pokemongo_bot/cell_workers/complete_tutorial.py\n+++ b/pokemongo_bot/cell_workers/complete_tutorial.py\n@@ -1,6 +1,7 @@\n import random\n \n from pokemongo_bot import logger\n+from pokemongo_bot.inventory import player\n from pokemongo_bot.base_task import BaseTask\n from pokemongo_bot.worker_result import WorkerResult\n from pokemongo_bot.human_behaviour import sleep\n@@ -15,23 +16,22 @@\n         self.api = self.bot.api\n         self.nickname = self.config.get('nickname','')\n         self.team = self.config.get('team',0)\n-        self.may_run = True\n-\n-    def should_run(self):\n-        return self.may_run\n+        self.tutorial_run = True\n+        self.team_run = True\n \n     def work(self):\n \n-        if not self.should_run():\n-            return WorkerResult.SUCCESS\n+        if self.tutorial_run:\n+            self.tutorial_run = False\n+            if not self._check_tutorial_state():\n+                return WorkerResult.ERROR\n \n-        # Only execute the worker once to avoid error loop\n-        self.may_run = False\n+        if self.team_run and player()._level >= 5:\n+            self.team_run = False\n+            if not self._set_team():\n+                return WorkerResult.ERROR\n \n-        if self._check_tutorial_state():\n-            return WorkerResult.SUCCESS\n-        else:\n-            return WorkerResult.ERROR\n+        return WorkerResult.SUCCESS\n \n     def _check_tutorial_state(self):\n         self._player=self.bot.player_data\n@@ -179,3 +179,36 @@\n         except KeyError:\n             self.logger.error(\"KeyError while setting tutorial state\")\n             return False\n+\n+    def _set_team(self):\n+        if self.team == 0:\n+            return True\n+\n+        if self.bot.player_data.get('team', 0) != 0:\n+            self.logger.info(u'Team already picked')\n+            return True\n+\n+        sleep(10)\n+        response_dict = self.api.set_player_team(team=self.team)\n+        try:\n+            result = response_dict['responses']['SET_PLAYER_TEAM']['status']\n+            if result == 1:\n+                team_codes = {\n+                    1: 'Mystic (BLUE)',\n+                    2: 'Valor (RED)',\n+                    3: 'Instinct (YELLOW)'\n+                }\n+                self.logger.info(u'Picked Team {}.'.format(team_codes[self.team]))\n+                return True\n+            else:\n+                error_codes = {\n+                    0: 'UNSET',\n+                    1: 'SUCCESS',\n+                    2: 'TEAM_ALREADY_SET',\n+                    3: 'FAILURE'\n+                }\n+                self.logger.error(u'Error while picking team : {}'.format(error_codes[result]))\n+                return False\n+        except KeyError:\n+            return False\n+\n", "issue": "Assign to Team after reaching lvl 5\n<!-- ===============FEATURE REQUEST SECTION===============\n\nBefore you create a Feature Request, please check the following:\n\n1. Have you [searched our feature tracker](https://github.com/PokemonGoF/PokemonGo-Bot/labels/Feature%20Request) first to ensure someone else hasn't already come up with the same great idea.  If so then be sure to +1 it \n2. While you're there, be sure to vote on other feature requests to let the devs know what is important to you.\n-->\n\n<!-- Note: Delete this line and everything ABOVE if creating a Feature Request -->\n### Short Description\n\n<!-- Tell us a short description of your request -->\n\nAdd the ability to assign to a team (blue, red, yellow) after bot is reaching lvl5\n\n<!-- ==========END OF FEATURE REQUEST SECTION========== -->\n\n", "before_files": [{"content": "import random\n\nfrom pokemongo_bot import logger\nfrom pokemongo_bot.base_task import BaseTask\nfrom pokemongo_bot.worker_result import WorkerResult\nfrom pokemongo_bot.human_behaviour import sleep\n\n\n\nclass CompleteTutorial(BaseTask):\n\n    SUPPORTED_TASK_API_VERSION = 1\n\n    def initialize(self):\n        self.api = self.bot.api\n        self.nickname = self.config.get('nickname','')\n        self.team = self.config.get('team',0)\n        self.may_run = True\n\n    def should_run(self):\n        return self.may_run\n\n    def work(self):\n\n        if not self.should_run():\n            return WorkerResult.SUCCESS\n\n        # Only execute the worker once to avoid error loop\n        self.may_run = False\n\n        if self._check_tutorial_state():\n            return WorkerResult.SUCCESS\n        else:\n            return WorkerResult.ERROR\n\n    def _check_tutorial_state(self):\n        self._player=self.bot.player_data\n\n        tutorial_state = self._player.get('tutorial_state', [])\n        # LEGAL_SCREEN = 0\n        if not 0 in tutorial_state:\n            sleep(2)\n            if self._set_tutorial_state(0):\n                self.logger.info('Completed legal screen')\n                tutorial_state = self._player.get('tutorial_state', [])\n            else:\n                return False\n\n        # AVATAR_SELECTION = 1\n        if not 1 in tutorial_state:\n            sleep(7)\n            if self._set_avatar():\n                if self._set_tutorial_state(1):\n                    self.logger.info('Completed avatar selection')\n                    tutorial_state = self._player.get('tutorial_state', [])\n                else:\n                    return False\n            else:\n                self.logger.error('Error during avatar selection')\n                return False\n\n        # POKEMON_CAPTURE = 3\n        if not 3 in tutorial_state:\n            sleep(10)\n            if self._encounter_tutorial():\n                self.logger.info('Completed first capture')\n            else:\n                self.logger.error('Error during first capture')\n                return False\n\n        # NAME_SELECTION = 4\n        if not 4 in tutorial_state:\n            if not self.nickname:\n                self.logger.info(\"No nickname defined in config\")\n                return False\n\n            self.logger.info(u'Trying to set {} as nickname'.format(self.nickname))\n            sleep(5)\n            if self._set_nickname(self.nickname):\n                self._set_tutorial_state(4)\n                tutorial_state = self._player.get('tutorial_state', [])\n            else:\n                self.logger.error('Error trying to set nickname')\n                return False\n\n        # FIRST_TIME_EXPERIENCE_COMPLETE = 7\n        if not 7 in tutorial_state:\n            if self._set_tutorial_state(7):\n                self.logger.info('Completed first time experience')\n            else:\n                return False\n\n        return True\n\n    def _encounter_tutorial(self):\n        # You just need to call the API with the pokemon you choose\n        # Probably can't get MewTwo as first pokemon though\n        first_pokemon_id = random.choice([1, 4, 7])\n        response_dict = self.api.encounter_tutorial_complete(\n            pokemon_id=first_pokemon_id)\n        try:\n            if response_dict['responses']['ENCOUNTER_TUTORIAL_COMPLETE']['result'] == 1:\n                return True\n            else:\n                self.logger.error(\"Error during encouter tutorial\")\n                return False\n        except KeyError:\n            self.logger.error(\"KeyError during encouter tutorial\")\n            return False\n\n    def _random_avatar(self):\n        avatar= {}\n        # 0 = Male, 1 = Female\n        avatar['gender']=random.randint(0,1)\n        # What is the max value of each parameter ?\n        # Default is 0, anyway human player will stop\n        # at the first choices in general, so fully\n        # random on the whole avatar space is not the way to go either\n        avatar['skin']=random.randint(0,3)\n        avatar['hair']=random.randint(0,3)\n        avatar['shirt']=random.randint(0,3)\n        avatar['pants']=random.randint(0,3)\n        avatar['hat']=random.randint(0,3)\n        avatar['shoes']=random.randint(0,3)\n        avatar['eyes']=random.randint(0,3)\n        avatar['backpack']=random.randint(0,3)\n        return avatar\n\n    def _set_avatar(self):\n        avatar = self._random_avatar()\n        response_dict = self.api.set_avatar(player_avatar=avatar)\n        status = response_dict['responses']['SET_AVATAR']['status']\n        try:\n            if status == 1:\n                return True\n            else:\n                error_codes = {\n                    0: 'UNSET',\n                    1: 'SUCCESS',\n                    2: 'AVATAR_ALREADY_SET',\n                    3: 'FAILURE',\n                }\n                self.logger.error(\"Error during avatar selection : {}\".format(error_codes[status]))\n                return False\n        except KeyError:\n            self.logger.error(\"KeyError during avatar selection\")\n            return False\n\n    def _set_nickname(self, nickname):\n        response_dict = self.api.claim_codename(codename=nickname)\n        try:\n            result = response_dict['responses']['CLAIM_CODENAME']['status']\n            if result == 1:\n                self.logger.info(u'Name changed to {}'.format(nickname))\n                return True\n            else:\n                # Would be nice to get the text directly from the proto Enum\n                error_codes = {\n                    0: 'UNSET',\n                    1: 'SUCCESS',\n                    2: 'CODENAME_NOT_AVAILABLE',\n                    3: 'CODENAME_NOT_VALID',\n                    4: 'CURRENT_OWNER',\n                    5: 'CODENAME_CHANGE_NOT_ALLOWED'\n                }\n                self.logger.error(\n                    u'Error while changing nickname : {}'.format(error_codes[result]))\n                return False\n        except KeyError:\n            return False\n\n    def _set_tutorial_state(self, completed):\n        response_dict = self.api.mark_tutorial_complete(tutorials_completed=[\n                                                        completed], send_marketing_emails=False, send_push_notifications=False)\n        try:\n            self._player = response_dict['responses'][\n                'MARK_TUTORIAL_COMPLETE']['player_data']\n            return response_dict['responses']['MARK_TUTORIAL_COMPLETE']['success']\n        except KeyError:\n            self.logger.error(\"KeyError while setting tutorial state\")\n            return False\n", "path": "pokemongo_bot/cell_workers/complete_tutorial.py"}], "after_files": [{"content": "import random\n\nfrom pokemongo_bot import logger\nfrom pokemongo_bot.inventory import player\nfrom pokemongo_bot.base_task import BaseTask\nfrom pokemongo_bot.worker_result import WorkerResult\nfrom pokemongo_bot.human_behaviour import sleep\n\n\n\nclass CompleteTutorial(BaseTask):\n\n    SUPPORTED_TASK_API_VERSION = 1\n\n    def initialize(self):\n        self.api = self.bot.api\n        self.nickname = self.config.get('nickname','')\n        self.team = self.config.get('team',0)\n        self.tutorial_run = True\n        self.team_run = True\n\n    def work(self):\n\n        if self.tutorial_run:\n            self.tutorial_run = False\n            if not self._check_tutorial_state():\n                return WorkerResult.ERROR\n\n        if self.team_run and player()._level >= 5:\n            self.team_run = False\n            if not self._set_team():\n                return WorkerResult.ERROR\n\n        return WorkerResult.SUCCESS\n\n    def _check_tutorial_state(self):\n        self._player=self.bot.player_data\n\n        tutorial_state = self._player.get('tutorial_state', [])\n        # LEGAL_SCREEN = 0\n        if not 0 in tutorial_state:\n            sleep(2)\n            if self._set_tutorial_state(0):\n                self.logger.info('Completed legal screen')\n                tutorial_state = self._player.get('tutorial_state', [])\n            else:\n                return False\n\n        # AVATAR_SELECTION = 1\n        if not 1 in tutorial_state:\n            sleep(7)\n            if self._set_avatar():\n                if self._set_tutorial_state(1):\n                    self.logger.info('Completed avatar selection')\n                    tutorial_state = self._player.get('tutorial_state', [])\n                else:\n                    return False\n            else:\n                self.logger.error('Error during avatar selection')\n                return False\n\n        # POKEMON_CAPTURE = 3\n        if not 3 in tutorial_state:\n            sleep(10)\n            if self._encounter_tutorial():\n                self.logger.info('Completed first capture')\n            else:\n                self.logger.error('Error during first capture')\n                return False\n\n        # NAME_SELECTION = 4\n        if not 4 in tutorial_state:\n            if not self.nickname:\n                self.logger.info(\"No nickname defined in config\")\n                return False\n\n            self.logger.info(u'Trying to set {} as nickname'.format(self.nickname))\n            sleep(5)\n            if self._set_nickname(self.nickname):\n                self._set_tutorial_state(4)\n                tutorial_state = self._player.get('tutorial_state', [])\n            else:\n                self.logger.error('Error trying to set nickname')\n                return False\n\n        # FIRST_TIME_EXPERIENCE_COMPLETE = 7\n        if not 7 in tutorial_state:\n            if self._set_tutorial_state(7):\n                self.logger.info('Completed first time experience')\n            else:\n                return False\n\n        return True\n\n    def _encounter_tutorial(self):\n        # You just need to call the API with the pokemon you choose\n        # Probably can't get MewTwo as first pokemon though\n        first_pokemon_id = random.choice([1, 4, 7])\n        response_dict = self.api.encounter_tutorial_complete(\n            pokemon_id=first_pokemon_id)\n        try:\n            if response_dict['responses']['ENCOUNTER_TUTORIAL_COMPLETE']['result'] == 1:\n                return True\n            else:\n                self.logger.error(\"Error during encouter tutorial\")\n                return False\n        except KeyError:\n            self.logger.error(\"KeyError during encouter tutorial\")\n            return False\n\n    def _random_avatar(self):\n        avatar= {}\n        # 0 = Male, 1 = Female\n        avatar['gender']=random.randint(0,1)\n        # What is the max value of each parameter ?\n        # Default is 0, anyway human player will stop\n        # at the first choices in general, so fully\n        # random on the whole avatar space is not the way to go either\n        avatar['skin']=random.randint(0,3)\n        avatar['hair']=random.randint(0,3)\n        avatar['shirt']=random.randint(0,3)\n        avatar['pants']=random.randint(0,3)\n        avatar['hat']=random.randint(0,3)\n        avatar['shoes']=random.randint(0,3)\n        avatar['eyes']=random.randint(0,3)\n        avatar['backpack']=random.randint(0,3)\n        return avatar\n\n    def _set_avatar(self):\n        avatar = self._random_avatar()\n        response_dict = self.api.set_avatar(player_avatar=avatar)\n        status = response_dict['responses']['SET_AVATAR']['status']\n        try:\n            if status == 1:\n                return True\n            else:\n                error_codes = {\n                    0: 'UNSET',\n                    1: 'SUCCESS',\n                    2: 'AVATAR_ALREADY_SET',\n                    3: 'FAILURE',\n                }\n                self.logger.error(\"Error during avatar selection : {}\".format(error_codes[status]))\n                return False\n        except KeyError:\n            self.logger.error(\"KeyError during avatar selection\")\n            return False\n\n    def _set_nickname(self, nickname):\n        response_dict = self.api.claim_codename(codename=nickname)\n        try:\n            result = response_dict['responses']['CLAIM_CODENAME']['status']\n            if result == 1:\n                self.logger.info(u'Name changed to {}'.format(nickname))\n                return True\n            else:\n                # Would be nice to get the text directly from the proto Enum\n                error_codes = {\n                    0: 'UNSET',\n                    1: 'SUCCESS',\n                    2: 'CODENAME_NOT_AVAILABLE',\n                    3: 'CODENAME_NOT_VALID',\n                    4: 'CURRENT_OWNER',\n                    5: 'CODENAME_CHANGE_NOT_ALLOWED'\n                }\n                self.logger.error(\n                    u'Error while changing nickname : {}'.format(error_codes[result]))\n                return False\n        except KeyError:\n            return False\n\n    def _set_tutorial_state(self, completed):\n        response_dict = self.api.mark_tutorial_complete(tutorials_completed=[\n                                                        completed], send_marketing_emails=False, send_push_notifications=False)\n        try:\n            self._player = response_dict['responses'][\n                'MARK_TUTORIAL_COMPLETE']['player_data']\n            return response_dict['responses']['MARK_TUTORIAL_COMPLETE']['success']\n        except KeyError:\n            self.logger.error(\"KeyError while setting tutorial state\")\n            return False\n\n    def _set_team(self):\n        if self.team == 0:\n            return True\n\n        if self.bot.player_data.get('team', 0) != 0:\n            self.logger.info(u'Team already picked')\n            return True\n\n        sleep(10)\n        response_dict = self.api.set_player_team(team=self.team)\n        try:\n            result = response_dict['responses']['SET_PLAYER_TEAM']['status']\n            if result == 1:\n                team_codes = {\n                    1: 'Mystic (BLUE)',\n                    2: 'Valor (RED)',\n                    3: 'Instinct (YELLOW)'\n                }\n                self.logger.info(u'Picked Team {}.'.format(team_codes[self.team]))\n                return True\n            else:\n                error_codes = {\n                    0: 'UNSET',\n                    1: 'SUCCESS',\n                    2: 'TEAM_ALREADY_SET',\n                    3: 'FAILURE'\n                }\n                self.logger.error(u'Error while picking team : {}'.format(error_codes[result]))\n                return False\n        except KeyError:\n            return False\n\n", "path": "pokemongo_bot/cell_workers/complete_tutorial.py"}]}