code: def apply_op(im, op, prob, magnitude):
      """Apply the selected op to image with given probability and magnitude."""
      # The magnitude is converted to an absolute value v for an op (some ops use -v or v)
      assert 0 <= magnitude <= 1
      assert op in OP_RANGES and op in OP_FUNCTIONS, "unknown op " + op
      if prob < 1 and random.random() > prob:
          return im
      min_v, max_v, negate = OP_RANGES[op]
      v = magnitude * (max_v - min_v) + min_v
      v = -v if negate and random.random() > 0.5 else v
      return OP_FUNCTIONS[op](im, v)
  
file_path: pycls/pycls/datasets/augment.py
imports: import random
  import numpy
  from PIL import Image, ImageEnhance, ImageOps
label_desc: Use image node_id 2 for calling a global function with example usage: apply_op(im, op, prob, magnitude) and returns: OP_FUNCTIONS, im