code: def any_of(value_s: str, union_type: Union) -> Any:
      """Attempts to parse the supplied string into one of the components of the
      supplied Union. Returns the value if possible, else raises a value error.
  
      union_type must be a union of enums!
  
      """
  
      def attempt(s: str, enum_type: Enum) -> Optional[Any]:
          try:
              return enum_type(s)
          except ValueError:
              return None
  
      enums = union_type.__args__
      ret = None
  
      for enum_type in enums:
          ret = attempt(value_s, enum_type)
          if ret is not None:
              break
  
      if ret is None:
          raise ValueError(
              "{} isn't a value of any of {}".format(value_s, enums)
          )
  
      return ret
  
imports: import getpass
  import itertools
  import os
  import platform
  import sys
  from enum import Enum
  from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Union
  from blessings import Terminal
  from pkg_resources import resource_filename
label_desc: Use image node_id 7 for calling a global function with example usage: any_of(value_s, union_type) and returns: ret, enum_type, None