code: def test_with_constraint():
      from mystic.math.measures import mean, impose_mean
  
      @with_constraint(inner, kwds={"target": 5.0})
      def mean_of_squared(x, target):
          return impose_mean(target, [i**2 for i in x])
  
      from numpy import array
  
      x = array([1, 2, 3, 4, 5])
      y = impose_mean(5, [i**2 for i in x])
      assert mean(y) == 5.0
      assert mean_of_squared(x) == y
  
file_path: mystic/mystic/tests/test_constraints.py
imports: from mystic.constraints import *
  from mystic.penalty import quadratic_equality
  from mystic.coupler import inner
  from mystic.math import almostEqual
  from mystic.tools import random_seed
label_desc: Use image node_id 10 for calling a global function with example usage: test_with_constraint() and returns: impose_mean