code: def look_up_operations(type_str, supported):
      """
      This function validates the ``type_str`` against the supported set.
  
      if ``supported`` is a ``set``, returns ``type_str``
      if ``supported`` is a ``dict``, return ``supported[type_str]``
      else:
      raise an error possibly with a guess of the closest match.
  
      :param type_str:
      :param supported:
      :return:
      """
      assert isinstance(
          type_str, string_types
      ), "unrecognised type string"
      if isinstance(supported, dict) and type_str in supported:
          return supported[type_str]
  
      if isinstance(supported, set) and type_str in supported:
          return type_str
  
      try:
          set_to_check = set(supported)
      except TypeError:
          set_to_check = set()
  
      edit_distances = {}
      for supported_key in set_to_check:
          edit_distance = damerau_levenshtein_distance(
              supported_key, type_str
          )
          if edit_distance <= 3:
              edit_distances[supported_key] = edit_distance
      if edit_distances:
          guess_at_correct_spelling = min(
              edit_distances, key=edit_distances.get
          )
          raise ValueError(
              'By "{0}", did you mean "{1}"?\n'
              '"{0}" is not a valid option.\n'
              "Available options are {2}\n".format(
                  type_str, guess_at_correct_spelling, supported
              )
          )
      else:
          raise ValueError(
              'No supported option "{}" '
              "is not found.\nAvailable options are {}\n".format(
                  type_str, supported
              )
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import datetime
  import os
  import re
  from functools import partial
  import numpy
  import tensorflow
  from scipy import ndimage
  from six import string_types
label_desc: Use image node_id 11 for calling a global function with example usage: look_up_operations(type_str, supported) and returns: supported, type_str