def _verify_function(name, func): if not callable(func): raise patch_user_exc(ValueError('scheduler.{}: func should be callable'.format(name))) sig = signature(func) if len(sig.parameters) != 2: raise patch_user_exc(TypeError( 'scheduler.{}: func should take exactly 2 arguments (context, bar_dict)'.format(name)))