class_docstr: Disable the ``{before,after}_epoch``, ``{before,after}_run``,
  ``trigger_{epoch,step}``
  methods of a callback, unless some condition satisfies.
  The other methods are unaffected.
  
  A more accurate name for this callback should be "DisableCallbackUnless", but that's too ugly.
  
  Note:
      If you use ``{before,after}_run``,
      ``pred`` will be evaluated only in ``before_run``.
docstr: Args:
      callback (Callback):
      pred (self -> bool): a callable predicate. Has to be a pure function.
          The callback is disabled unless this predicate returns True.
docstr_tok: ["Args",":","callback","(","Callback",")",":","pred","(","self","-",">","bool",")",":","a","callable","predicate",".","Has","to","be","a","pure","function",".","The","callback","is","disabled","unless","this","predicate","returns","True","."]
code: def __init__(self, callback, pred):
      """
      Args:
          callback (Callback):
          pred (self -> bool): a callable predicate. Has to be a pure function.
              The callback is disabled unless this predicate returns True.
      """
      self._pred = pred
      super(EnableCallbackIf, self).__init__(callback)
  
imports: from .base import Callback, ProxyCallback
label_desc: Use image node_id 1 to create a new EnableCallbackIf object from inherited base classes: ProxyCallback with example: obj = EnableCallbackIf(callback, pred)