def is_permitted(): def predicate(ctx): if is_permitted_check(ctx): return True else: raise errors.NotPermitted return commands.check(predicate)