def create_account(self, username, password, email, agreement=False, locale="en", scopes=__DEFAULT_SCOPES, to_file=None):
        """
        Creates a new user account with the given username, password and email. "agreement"
        must be set to true (after showing the user the instances user agreement and having
        them agree to it), "locale" specifies the language for the confirmation e-mail as an
        ISO 639-1 (two-letter) language code.
        
        Does not require an access token, but does require a client grant.
        
        By default, this method is rate-limited by IP to 5 requests per 30 minutes.
        
        Returns an access token (just like log_in), which it can also persist to to_file,
        and sets it internally so that the user is now logged in. Note that this token 
        can only be used after the user has confirmed their e-mail.
        """
        params = self.__generate_params(locals(), ['to_file', 'scopes'])
        params['client_id'] = self.client_id
        params['client_secret'] = self.client_secret
        
        if agreement == False:
            del params_initial['agreement']
        
        # Step 1: Get a user-free token via oauth
        try:
            oauth_params = {}
            oauth_params['scope'] = " ".join(scopes)
            oauth_params['client_id'] = self.client_id
            oauth_params['client_secret'] = self.client_secret
            oauth_params['grant_type'] = 'client_credentials'
            
            response = self.__api_request('POST', '/oauth/token', oauth_params, do_ratelimiting=False)
            temp_access_token = response['access_token']
        except Exception as e:
            raise MastodonIllegalArgumentError('Invalid request during oauth phase: %s' % e)
        
        # Step 2: Use that to create a user
        try:
            response = self.__api_request('POST', '/api/v1/accounts', params, do_ratelimiting=False, 
                                          access_token_override = temp_access_token)
            self.access_token = response['access_token']
            self.__set_refresh_token(response.get('refresh_token'))
            self.__set_token_expired(int(response.get('expires_in', 0)))
        except Exception as e:
            raise MastodonIllegalArgumentError('Invalid request: %s' % e)
        
        # Step 3: Check scopes, persist, et cetera
        received_scopes = response["scope"].split(" ")
        for scope_set in self.__SCOPE_SETS.keys():
            if scope_set in received_scopes:
                received_scopes += self.__SCOPE_SETS[scope_set]
        
        if not set(scopes) <= set(received_scopes):
            raise MastodonAPIError(
                'Granted scopes "' + " ".join(received_scopes) + '" do not contain all of the requested scopes "' + " ".join(scopes) + '".')
        
        if to_file is not None:
            with open(to_file, 'w') as token_file:
                token_file.write(response['access_token'] + '\n')
        
        self.__logged_in_id = None
        
        return response['access_token']