def permission_check(check):
 def decorator(cls):
  cls.check_permission = staticmethod(check)
  return cls
 return decorator

def permission_check ( check ) : def decorator ( cls ) : cls . check_permission = staticmethod ( check ) return cls return decorator
class decorator for subclasses of publictask to sprinkle in re-usable permission checks:: @permission_check class mytask: def run_public: pass .