code: def connection_lost(self, exc):
          '''Called by asyncio when the connection closes.
  
          Tear down things done in connection_made.'''
          # Work around uvloop bug; see https://github.com/MagicStack/uvloop/issues/246
          if self.transport:
              self.transport = None
              self.closed_event.set()
              # Release waiting tasks
              self._can_send.set()
              # Cancelling directly leads to self-cancellation problems for member
              # functions await-ing self.close()
              self.loop.call_soon(self._task.cancelf connection_lost(self, exc):
          '''Called by asyncio when the connection closes.
  
          Tear down things done in connection_made.'''
          # Work around uvloop bug; see https://github.com/MagicStack/uvloop/issues/246
          if self.transport:
              self.transport = None
              self.closed_event.set()
              # Release waiting tasks
              self._can_send.set()
              # Cancelling directly leads to self-cancellation problems for member
              # functions await-ing self.close()
              self.loop.call_soon(self._task.cancel)
docs: Called by asyncio when the connection closes.
  
          Tear down things done in connection_made.