code: def delegate_to_method(mtd):
      
  
      def _delegate_to_method(cls, ops, kwargs):
          assert len(ops) == 1
          op, = ops
          if hasattr(op, mtd):
              return getattr(op, mtd)()
          else:
              return ops, kwargs
  
      return _delegate_to_method
docs: Create a simplification rule that delegates the instantiation to the
      method `mtd` of the operand (if defined)