def ensureTokenScopes(token, scope):
    tokenModel = ModelImporter.model('token')
    if tokenModel.hasScope(token, TokenScope.USER_AUTH):
        return

    if not tokenModel.hasScope(token, scope):
        setattr(cherrypy.request, 'girderUser', None)
        if isinstance(scope, six.string_types):
            scope = (scope,)
        raise AccessException(
            'Invalid token scope.\n'
            'Required: %s.\n'
            'Allowed: %s' % (
                ' '.join(scope), ' '.join(tokenModel.getAllowedScopes(token))))
detach() -> file descriptor
dataset/ETHPy150Open girder/girder/girder/api/rest.py/ensureTokenScopes--crossover with--dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/socket.py/socket.detach