<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(self,soft_reset=False,**options):
 """ This just creates the websocket connection """

        self._state = STATE_CONNECTING
        logger.debug("About to connect to {}".format(self.url))

        m = re.search('(ws+)://([\w\.]+)(:?:(\d+))?',self.url)

        options['subprotocols'] = ['wamp.2.json']
        options['enable_multithread'] = True
        options.setdefault('timeout',self._loop_timeout)

        # Handle the weird issue in websocket that the origin
        # port will be always http://host:port even though connection is
        # wss. This causes some origin issues with demo.crossbar.io demo
        # so we ensure we use http or https appropriately depending on the
        # ws or wss protocol
        if m and m.group(1).lower() == 'wss':
            origin_port = ':'+m.group(3) if m.group(3) else ''
            options['origin'] = u'https://{}{}'.format(m.group(2),origin_port)

        # Attempt connection once unless it's autoreconnect in which
        # case we try and try again...
        while True:
            try:
                if self.sslopt:
                    options.setdefault('sslopt',self.sslopt)

                # By default if no settings are chosen we apply
                # the looser traditional policy (makes life less
                # secure but less excruciating on windows)
                if options.get('sslopt') is None:
                    options['sslopt'] = {
                        "cert_reqs":ssl.CERT_NONE,
                        "check_hostname": False
                    }

                if self.sockopt:
                    options.setdefault('sockopt',self.sockopt)

                self.ws = websocket.create_connection(
                                self.url,
                                **options
                            )
                self.handle_connect()
            except Exception as ex:
                if self.auto_reconnect:
                    logger.debug(
                        "Error connecting to {url}. Reconnection attempt in {retry} second(s). {err}".format(
                            url=self.url,
                            retry=self.auto_reconnect,
                            err=ex
                        )
                    )
                    time.sleep(self.auto_reconnect)
                    continue
                else:
                    raise
            break

        logger.debug("Connected to {}".format(self.url))
        if not soft_reset:
            self._subscriptions    = {}
            self._registered_calls = {}
        self._requests_pending = {}
        self._state = STATE_WEBSOCKET_CONNECTED

        # notify the threading.Conditional that restart can happen
        self._request_loop_notify_restart.acquire()
        self._request_loop_notify_restart.notify()
        self._request_loop_notify_restart.release()