code: def _op_factory(func, kwargs, opname, bands, rgb_op=False):
      
  
      def f(arr):
          # Avoid mutation by copying
          newarr = arr.copy()
          if rgb_op:
              # apply func to array's first 3 bands, assumed r,g,b
              # additional band(s) are untouched
              newarr[0:3] = func(newarr[0:3], **kwargs)
          else:
              # apply func to array band at a time
              for b in bands:
                  newarr[b - 1] = func(arr[b - 1], **kwargs)
          return newarr
  
      f.__name__ = str(opname)
      return f
docs: create an operation function closure
      don't call directly, use parse_operations
      returns a function which itself takes and returns ndarrays