code: def write(self, data):
          '''
          Write some bytes to the transport.
          '''
          if not hasattr(self, '_sock'):
              return None
  
          try:
              self._sock.sendall(data)
  
              if self.connection.debug > 1:
                  self.connection.logger.debug(
                      'sent %d bytes to %s' % (len(data), self._host))
  
              return
          except EnvironmentError:
              # sockets raise this type of error, and since if sendall() fails
              # we're left in an indeterminate state, assume that any error we
              # catch means that the connection is dead. Note that this
              # assumption requires this to be a blocking socket; if we ever
              # support non-blocking in this class then this whole method has
              # to change a lot.
              self.connection.logger.exception(
                  'error writing to %s' % (self._host))
  
          self.connection.transport_closed(
              msg='error writing to %s' % (self._host)f write(self, data):
          '''
          Write some bytes to the transport.
          '''
          if not hasattr(self, '_sock'):
              return None
  
          try:
              self._sock.sendall(data)
  
              if self.connection.debug > 1:
                  self.connection.logger.debug(
                      'sent %d bytes to %s' % (len(data), self._host))
  
              return
          except EnvironmentError:
              # sockets raise this type of error, and since if sendall() fails
              # we're left in an indeterminate state, assume that any error we
              # catch means that the connection is dead. Note that this
              # assumption requires this to be a blocking socket; if we ever
              # support non-blocking in this class then this whole method has
              # to change a lot.
              self.connection.logger.exception(
                  'error writing to %s' % (self._host))
  
          self.connection.transport_closed(
              msg='error writing to %s' % (self._host))
docs: Write some bytes to the transport.