<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def check(self, user, provider, permission, **kwargs):
        '''
            user - django User or UserSocialAuth instance
            provider - name of publisher provider
            permission - if backend maintains check permissions
                            vk - binary mask in int format
                            facebook - scope string
        '''
        try:
            social_user = self._get_social_user(user, provider)
            if not social_user:
                return False

        except SocialUserDoesNotExist:
            return False

        backend = self.get_backend(social_user, provider, context=kwargs)
        return backend.check(permission)