code: def get_validate_choice_fn(choices):
      """Returns a validate_fn for use with from_conf().
      The validate_fn will check a value against a list of allowed choices.
      """
  
      def _validate_choice(name, value):
          if value not in choices:
              raise MetaflowException(
                  "%s must be set to one of %s. Got '%s'."
                  % (name, choices, value)
              )
  
      return _validate_choice
  
file_path: metaflow/metaflow/metaflow_config_funcs.py
imports: import json
  import os
  from collections import namedtuple
  from metaflow.exception import MetaflowException
  from metaflow.util import is_stringish
label_desc: Use image node_id 4 for calling a global function with example usage: get_validate_choice_fn(choices) and returns: _validate_choice