async def connect_async(self, loop=None, timeout=None):
if self.deferred:<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if self._async_conn:<EOL><INDENT>return<EOL><DEDENT>elif self._async_wait:<EOL><INDENT>await self._async_wait<EOL><DEDENT>else:<EOL><INDENT>self._loop = loop<EOL>self._async_wait = asyncio.Future(loop=self._loop)<EOL>conn = self._async_conn_cls(<EOL>database=self.database,<EOL>loop=self._loop,<EOL>timeout=timeout,<EOL>**self.connect_params_async)<EOL>try:<EOL><INDENT>await conn.connect()<EOL><DEDENT>except Exception as e:<EOL><INDENT>if not self._async_wait.done():<EOL><INDENT>self._async_wait.set_exception(e)<EOL><DEDENT>self._async_wait = None<EOL>raise<EOL><DEDENT>else:<EOL><INDENT>self._task_data = TaskLocals(loop=self._loop)<EOL>self._async_conn = conn<EOL>self._async_wait.set_result(True)<EOL><DEDENT><DEDENT>
Set up async connection on specified event loop or
        on default event loop.