code: def maybe_parse_user_type(t):
      
      is_type = isinstance(t, type)
      is_preserved = isinstance(t, type) and issubclass(t, _preserved_iterable_types)
      is_string = isinstance(t, string_types)
      is_iterable = isinstance(t, Iterable)
  
      if is_preserved:
          return [t]
      elif is_string:
          return [t]
      elif is_type and not is_iterable:
          return [t]
      elif is_iterable:
          # Recur to validate contained types as well.
          ts = t
          return tuple(e for t in ts for e in maybe_parse_user_type(t))
      else:
          # If this raises because `t` cannot be formatted, so be it.
          raise TypeError(
              'Type specifications must be types or strings. Input: {}'.format(t)
          )
docs: Try to coerce a user-supplied type directive into a list of types.
  
      This function should be used in all places where a user specifies a type,
      for consistency.
  
      The policy for what defines valid user input should be clear from the implementation.