<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _start_indieauth(self, me, redirect_url, state, scope):
 """Helper for both authentication and authorization. Kicks off IndieAuth by fetching the authorization endpoint from the user's homepage and redirecting to it. Args: me (string):
 the authing user's URL. if it does not begin with https?://, http:// will be prepended. redirect_url: the callback URL that we pass to the auth endpoint. state (string, optional):
 passed through the whole auth process, useful if you want to maintain some state, e.g. the url to return to when the process is complete. scope (string):
 a space-separated string of micropub scopes. Returns: a redirect to the user's specified authorization https://indieauth.com/auth if none is provided. """


        if not me.startswith('http://') and not me.startswith('https://'):
            me = 'http://' + me
        auth_url, token_url, micropub_url = self._discover_endpoints(me)
        if not auth_url:
            auth_url = DEFAULT_AUTH_URL

        csrf_token = uuid.uuid4().hex
        flask.session['_micropub_csrf_token'] = csrf_token

        auth_params = {
            'me': me,
            'client_id': self.client_id,
            'redirect_uri': redirect_url,
            'response_type': 'code',
            'state': '{}|{}'.format(csrf_token, state or ''),
        }
        if scope:
            auth_params['scope'] = scope

        auth_url = auth_url + '?' + urlencode(auth_params)
        flask.current_app.logger.debug('redirecting to %s', auth_url)

        return flask.redirect(auth_url)