<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_access_credentials(self, scope, access_token, refresh_token=None, update_user=True):
 """Set the credentials used for OAuth2 authentication. Calling this function will overwrite any currently existing access credentials. :param scope: A set of reddit scopes the tokens provide access to :param access_token: the access token of the authentication :param refresh_token: the refresh token of the authentication :param update_user: Whether or not to set the user attribute for identity scopes """

        if isinstance(scope, (list, tuple)):
            scope = set(scope)
        elif isinstance(scope, six.string_types):
            scope = set(scope.split())
        if not isinstance(scope, set):
            raise TypeError('`scope` parameter must be a set')
        self.clear_authentication()
        # Update authentication settings
        self._authentication = scope
        self.access_token = access_token
        self.refresh_token = refresh_token
        # Update the user object
        if update_user and ('identity' in scope or '*' in scope):
            self.user = self.get_me()