We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
complete_tutorial.py appears to have issue
Using fresh clones of both master and dev. Also clean install of pgoapi. Using default config to test results in same error.

```[2017-07-18 19:25:38] Error during protoc parsing - ignored.
[2017-07-18 19:25:38] Parsing sub RPC responses...
[2017-07-18 19:25:38] Parsing class: pogoprotos.networking.responses.get_map_objects_response_pb2.get_map_objects_response
[2017-07-18 19:25:38] Generating main RPC request...
[2017-07-18 19:25:38] Incremented RPC Request ID: 5359935399462436910
[2017-07-18 19:25:38] Generating sub RPC requests...
[2017-07-18 19:25:38] Subrequest class: pogoprotos.networking.requests.messages.set_avatar_message_pb2.set_avatar_message
[2017-07-18 19:25:38] Request failed, retrying.
[2017-07-18 19:25:39] [bot_interrupted] Bot caught SIGINT. Shutting down.
[2017-07-18 19:25:39] Creating a new request...
[2017-07-18 19:25:39] Adding 'GET_INVENTORY' to RPC request
[2017-07-18 19:25:39] Generating main RPC request...
[2017-07-18 19:25:39] Incremented RPC Request ID: 7861386947506208815
[2017-07-18 19:25:39] Generating sub RPC requests...
[2017-07-18 19:25:39] Generating platform RPC requests...
[2017-07-18 19:25:39] Session Ticket still valid for further 00:29:21 hours (1500420339304 < 1500422100916)
[2017-07-18 19:25:39] Found Session Ticket - using this instead of oauth token
[2017-07-18 19:25:39] "POST /api/v137_1/hash HTTP/1.1" 200 None
[2017-07-18 19:25:39] Generated protobuf request:
status_code: 2



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

{"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@@ -119,13 +119,13 @@\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+        avatar['avartar_hair']=random.randint(0,3)\n+        avatar['avartar_shirt']=random.randint(0,3)\n+        avatar['avartar_pants']=random.randint(0,3)\n+        avatar['avartar_hat']=random.randint(0,3)\n+        avatar['avartar_shoes']=random.randint(0,3)\n+        avatar['avartar_eyes']=random.randint(0,3)\n+        avatar['avartar_backpack']=random.randint(0,3)\n         return avatar\n \n     def _set_avatar(self):\n", "issue": "complete_tutorial.py appears to have issue\nUsing fresh clones of both master and dev. Also clean install of pgoapi. Using default config to test results in same error.\r\n\r\n```[2017-07-18 19:25:38] Error during protoc parsing - ignored.\r\n[2017-07-18 19:25:38] Parsing sub RPC responses...\r\n[2017-07-18 19:25:38] Parsing class: pogoprotos.networking.responses.get_map_objects_response_pb2.get_map_objects_response\r\n[2017-07-18 19:25:38] Generating main RPC request...\r\n[2017-07-18 19:25:38] Incremented RPC Request ID: 5359935399462436910\r\n[2017-07-18 19:25:38] Generating sub RPC requests...\r\n[2017-07-18 19:25:38] Subrequest class: pogoprotos.networking.requests.messages.set_avatar_message_pb2.set_avatar_message\r\n[2017-07-18 19:25:38] Request failed, retrying.\r\n[2017-07-18 19:25:39] [bot_interrupted] Bot caught SIGINT. Shutting down.\r\n[2017-07-18 19:25:39] Creating a new request...\r\n[2017-07-18 19:25:39] Adding 'GET_INVENTORY' to RPC request\r\n[2017-07-18 19:25:39] Generating main RPC request...\r\n[2017-07-18 19:25:39] Incremented RPC Request ID: 7861386947506208815\r\n[2017-07-18 19:25:39] Generating sub RPC requests...\r\n[2017-07-18 19:25:39] Generating platform RPC requests...\r\n[2017-07-18 19:25:39] Session Ticket still valid for further 00:29:21 hours (1500420339304 < 1500422100916)\r\n[2017-07-18 19:25:39] Found Session Ticket - using this instead of oauth token\r\n[2017-07-18 19:25:39] \"POST /api/v137_1/hash HTTP/1.1\" 200 None\r\n[2017-07-18 19:25:39] Generated protobuf request:\r\nstatus_code: 2\r\n\r\n\n", "before_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.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        \n        request = self.bot.api.create_request()\n        request.encounter_tutorial_complete(pokemon_id=first_pokemon_id)\n        response_dict = request.call()\n        \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        \n        request = self.bot.api.create_request()\n        request.set_avatar(player_avatar=avatar)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.claim_codename(codename=nickname)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.mark_tutorial_complete(tutorials_completed=[completed], \n                                       send_marketing_emails=False,\n                                       send_push_notifications=False)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.set_player_team(team=self.team)\n        response_dict = request.call()\n        \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"}], "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.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        \n        request = self.bot.api.create_request()\n        request.encounter_tutorial_complete(pokemon_id=first_pokemon_id)\n        response_dict = request.call()\n        \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['avartar_hair']=random.randint(0,3)\n        avatar['avartar_shirt']=random.randint(0,3)\n        avatar['avartar_pants']=random.randint(0,3)\n        avatar['avartar_hat']=random.randint(0,3)\n        avatar['avartar_shoes']=random.randint(0,3)\n        avatar['avartar_eyes']=random.randint(0,3)\n        avatar['avartar_backpack']=random.randint(0,3)\n        return avatar\n\n    def _set_avatar(self):\n        avatar = self._random_avatar()\n        \n        request = self.bot.api.create_request()\n        request.set_avatar(player_avatar=avatar)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.claim_codename(codename=nickname)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.mark_tutorial_complete(tutorials_completed=[completed], \n                                       send_marketing_emails=False,\n                                       send_push_notifications=False)\n        response_dict = request.call()\n        \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        request = self.bot.api.create_request()\n        request.set_player_team(team=self.team)\n        response_dict = request.call()\n        \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"}]}