code: def write(self, data):
          
  
          while data:
              try:
                  n = self._socket.send(data)
              except socket.error:
                  n = None
              if not n:
                  raise EOFError('Socket closed')
              data = data[n:]
docs: Send *n* bytes to socket.
  
          Args:
              data(bytes): The data to send.
  
          Raises:
              EOFError: If the socket was closed.