<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def launch_app(self, timeout=10):
 """ Launch Spotify application. Will raise a LaunchError exception if there is no response from the Spotify app within timeout seconds. """


        def callback():
            """Callback function"""
            self.send_message({"type": TYPE_STATUS,
                               "credentials": self.access_token,
                               "expiresIn": self.expires})

        self.launch(callback_function=callback)

        # Need to wait for Spotify to be launched on Chromecast completely
        while not self.is_launched and timeout:
            time.sleep(1)
            timeout -= 1

        if not self.is_launched:
            raise LaunchError(
                "Timeout when waiting for status response from Spotify app")