<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _open_for_write(self):
 """open the file in write mode"""

        def put_request(body):
            """

            :param body:
            """
            ownerid, datasetid = parse_dataset_key(self._dataset_key)
            response = requests.put(
                "{}/uploads/{}/{}/files/{}".format(
                    self._api_host, ownerid, datasetid, self._file_name),
                data=body,
                headers={
                    'User-Agent': self._user_agent,
                    'Authorization': 'Bearer {}'.format(
                        self._config.auth_token)
                })
            self._response_queue.put(response)

        body = iter(self._queue.get, self._sentinel)
        self._thread = Thread(target=put_request, args=(body,))
        self._thread.start()