<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def _reconnect(self):
 """ Called when the remote server is innacessible and the connection has to be restarted """


        # 1. Close all transactions
        for msg_class in self._transactions:
            _1, _2, _3, coroutine_abrt, _4 = self._msgs_registered[msg_class]
            if coroutine_abrt is not None:
                for key in self._transactions[msg_class]:
                    for args, kwargs in self._transactions[msg_class][key]:
                        self._loop.create_task(coroutine_abrt(key, *args, **kwargs))
            self._transactions[msg_class] = {}

        # 2. Call on_disconnect
        await self._on_disconnect()

        # 3. Stop tasks
        for task in self._restartable_tasks:
            task.cancel()
        self._restartable_tasks = []

        # 4. Restart socket
        self._socket.disconnect(self._router_addr)

        # 5. Re-do start sequence
        await self.client_start()