code: def is_instance_factory(_type):
      """
  
      Parameters
      ----------
      `_type` - the type to be checked against
  
      Returns
      -------
      validator - a function of a single argument x , which raises
                  ValueError if x is not an instance of `_type`
  
      """
      if isinstance(_type, (tuple, list)):
          _type = tuple(_type)
          from pandas.io.formats.printing import pprint_thing
  
          type_repr = "|".join(map(pprint_thing, _type))
      else:
          type_repr = "'{typ}'".format(typ=_type)
  
      def inner(x):
          if not isinstance(x, _type):
              msg = "Value must be an instance of {type_repr}"
              raise ValueError(msg.format(type_repr=type_repr))
  
      return inner
  
imports: from collections import namedtuple
  from contextlib import contextmanager
  import re
  import warnings
  import pandas.compat
  from pandas.compat import lmap, map, u
label_desc: Use image node_id 20 for calling a global function with example usage: is_instance_factory(_type) and returns: inner