code: def readline(self, raise_exception=False):
          
          buf = self.buffer
          if self.socket:
              recv = self.socket.recv
          else:
              recv = lambda bufsize: ''
  
          while True:
              index = buf.find('\r\n')
              if index >= 0:
                  break
              data = recv(4096)
              if not data:
                  # connection close, let's kill it and raise
                  self.mark_dead('connection closed in readline()')
                  if raise_exception:
                      raise _ConnectionDeadError()
                  else:
                      return ''
  
              buf += data
          self.buffer = buf[index+2:]
          return buf[:index]
docs: Read a line and return it.  If "raise_exception" is set,
          raise _ConnectionDeadError if the read fails, otherwise return
          an empty string.