code: def _sample_parameters(param_grid):
      """
      Given a param_grid with callables and lists, execute callables and sample lists to return of random combination
      of parameters.
  
      Parameters
      ----------
      param_grid: dict
          Parameter configurations.
          Example::
              param_grid = {"k": [50, 100], "eta": lambda: np.random.choice([1, 2, 3])}
  
      Returns
      -------
      params: dict
          Return dictionary containing sampled parameters.
  
      """
      param = {}
      for k, v in param_grid.items():
          if callable(v):
              param[k] = v()
          elif isinstance(v, dict):
              param[k] = _sample_parameters(v)
          elif isinstance(v, Iterable) and not isinstance(v, str):
              param[k] = np.random.choice(v)
          else:
              param[k] = v
      return param
  
imports: import logging
  from collections.abc import Iterable
  from itertools import islice, product
  import numpy
  import pandas
  from tqdm import tqdm
  from ..evaluation import hits_at_n_score, mr_score, mrr_score
label_desc: Use image node_id 7 for calling a global function with example usage: _sample_parameters(param_grid) and returns: param