code: def verify_inference(values, expected_type):
      # Go through and build a list of all the possible value enumerations that need to be tested.
      def build_lookups(values, L):
          for v in values:
              if id(v) in special_types:
                  L.append(range(len(v)))
              elif type(v) is list:
                  build_lookups(v, L)
  
      indices = []
      build_lookups(values, indices)
  
      def get_value(values, idx_set):
          ret = copy(values)
          for i, v in enumerate(values):
              if id(v) in special_types:
                  ret[i] = v[idx_set[-1]]
                  del idx_set[-1]
              elif type(v) is list:
                  ret[i] = get_value(v, idx_set)
          return ret
  
      for idx_set in product(*reversed(indices)):
          _v_list = get_value(values, list(idx_set))
  
          for add_none in [True, False]:
              v_list = _v_list + [None] if add_none else _v_list
  
              inferred_type, result = _get_inferred_column_type(v_list)
  
              if inferred_type != expected_type:
                  assert False, (
                      "Expected type %s, got type %s; input value = %s."
                      % (
                          str(expected_type),
                          str(inferred_type),
                          str(v_list),
                      )
                  )
  
              if inferred_type != NoneType:
                  reconverted_result = _tr_flex_list(
                      result, inferred_type
                  )
                  assert str(result) == str(reconverted_result), (
                      "Values in type translated inconsistently: "
                      "\nInput value  = %s"
                      "\nOutput value = %s"
                      "\nReconverted  = %s"
                  ) % (str(v_list), str(result), reconverted_result)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import numpy
  from numpy import nan
  import array
  import datetime
  from ..data_structures import image
  from ..None import SArray
  import os
  from .._cython.cy_flexible_type import _translate_through_flexible_type
  from .._cython.cy_flexible_type import _translate_through_flex_list
  from .._cython.cy_flexible_type import infer_type_of_list
  from .._cython.cy_flexible_type import _get_inferred_column_type, _all_convertable
  from .._cython.cy_flexible_type import _check_ft_pyobject_hint_path
  from .._cython.cy_flexible_type import pytype_from_type_name
  from .._cython.cy_flexible_type import GMT
  import datetime
  from itertools import product
  from copy import copy
  import pytest
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: verify_inference(values, expected_type) and returns: ret