code: def sample(expr, rng=None, **kwargs):
      """
      Parameters:
      expr - a pyll expression to be evaluated
  
      rng - a np.random.RandomState instance
            default: `np.random.RandomState()`
  
      **kwargs - optional arguments passed along to
                 `hyperopt.pyll.rec_eval`
  
      """
      if rng is None:
          rng = np.random.RandomState()
      foo = recursive_set_rng_kwarg(
          clone(as_apply(expr)), as_apply(rng)
      )
      return rec_eval(foo, **kwargs)
  
imports: from __future__ import print_function
  from __future__ import division
  from builtins import range
  from past.utils import old_div
  import sys
  import numpy
  from .base import scope, as_apply, dfs, rec_eval, clone
label_desc: Use image node_id 17 for calling a global function with example usage: sample(expr, rng) and returns: rec_eval