docs: def smart_cast(var, type_):
      """
      casts var to type, and tries to be clever when var is a string
  
      Args:
          var (object): variable to cast
          type_ (type or str): type to attempt to cast to
  
      Returns:
          object:
  
      CommandLine:
          python -m utool.util_type --exec-smart_cast
  
      Example:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_type import *  # NOQA
          >>> var = '1'
          >>> type_ = 'fuzzy_subset'
          >>> cast_var = smart_cast(var, type_)
          >>> result = repr(cast_var)
          >>> print(result)
          [1]
  
      Example1:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_type import *  # NOQA
          >>> import utool as ut
          >>> cast_var = smart_cast('1', None)
          >>> result = ut.repr2(cast_var)
          >>> print(result)
          '1'
  
      Example2:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_type import *  # NOQA
          >>> cast_var = smart_cast('(1,3)', 'eval')
          >>> result = repr(cast_var)
          >>> print(result)
          (1, 3)
  
      Example3:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_type import *  # NOQA
          >>> cast_var = smart_cast('(1,3)', eval)
          >>> result = repr(cast_var)
          >>> print(result)
          (1, 3)
  
      Example4:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_type import *  # NOQA
          >>> cast_var = smart_cast('1::3', slice)
          >>> result = repr(cast_var)
          >>> print(result)
          slice(1, None, 3)
      """
      #if isinstance(type_, tuple):
      #    for trytype in type_:
      #        try:
      #            return trytype(var)
      #        except Exception:
      #            pass
      #    raise TypeError('Cant figure out type=%r' % (type_,))
      if type_ is None or var is None:
          return var
      #if not isinstance(type_, six.string_types):
      try:
          if issubclass(type_, type(None)):
              return var
      except TypeError:
          pass
      if is_str(var):
          if type_ in VALID_BOOL_TYPES:
              return bool_from_str(var)
          elif type_ is slice:
              args = [None if len(arg) == 0 else int(arg) for arg in var.split(':')]
              return slice(*args)
          elif type_ is list:
              # need more intelligent parsing here
              subvar_list = var.split(',')
              return [smart_cast2(subvar) for subvar in subvar_list]
          elif isinstance(type_, six.string_types):
              if type_ == 'fuzzy_subset':
                  return fuzzy_subset(var)
              if type_ == 'eval':
                  return eval(var, {}, {})
              #elif type_ == 'fuzzy_int':
              #    return fuzzy_subset(var)
              else:
                  raise NotImplementedError('Uknown smart type_=%r' % (type_,))
      return type_(var)