code: def connect(self):
          
          self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          self._socket.settimeout(self._connect_timeout)
          SocketError.wrap(self._socket.connect, (self.host, self.port))
          self._socket.settimeout(None)
          self._socket_file = self._socket.makefile('rb')
docs: Connect to beanstalkd server.