code: async def tx(self, mesg):
          '''
          Async transmit routine which will wait for writer drain().
          '''
          if self.isfini:
              raise s_exc.IsFini()
  
          byts = s_msgpack.en(mesg)
          try:
  
              self.writer.write(byts)
  
              # Avoid Python bug.  See https://bugs.python.org/issue29930
              async with self._drain_lock:
                  await self.writer.drain()
  
          except Exception as e:
  
              await self.fini()
  
              einfo = s_common.retnexc(e)
              logger.debug('link.tx connection trouble %s', einfo)
  
              raisync def tx(self, mesg):
          '''
          Async transmit routine which will wait for writer drain().
          '''
          if self.isfini:
              raise s_exc.IsFini()
  
          byts = s_msgpack.en(mesg)
          try:
  
              self.writer.write(byts)
  
              # Avoid Python bug.  See https://bugs.python.org/issue29930
              async with self._drain_lock:
                  await self.writer.drain()
  
          except Exception as e:
  
              await self.fini()
  
              einfo = s_common.retnexc(e)
              logger.debug('link.tx connection trouble %s', einfo)
  
              raise
docs: Async transmit routine which will wait for writer drain().