<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(self, timeout=None):
 """Connect to KATCP interface, starting what is needed Parameters timeout : float, None Time to wait until connected. No waiting if None. Raises ------ :class:`tornado.gen.TimeoutError` if the connect timeout expires """

        # Start KATCP device client.
        assert not self._running
        maybe_timeout = future_timeout_manager(timeout)

        self._logger.debug('Starting katcp client')
        self.katcp_client.start()
        try:
            yield maybe_timeout(self.katcp_client.until_running())
            self._logger.debug('Katcp client running')
        except tornado.gen.TimeoutError:
            self.katcp_client.stop()
            raise

        if timeout:
            yield maybe_timeout(self.katcp_client.until_connected())
        self._logger.debug('Katcp client connected')

        self._running = True
        self._state_loop()