code: def connect(self):
          
          self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          try:
              self.socket.connect((self.host, self.port))
          except socket.error as (err, msg):
              self.connected = False
              raise ScratchError("[Errno %d] %s" % (err, msg))
          self.connected = True
docs: Connects to Scratch.