code: def _validate_none_or_type(t):
      
      def _validate(setting):
          """
          Check the setting to make sure it's the right type.
  
          Args:
              setting (object): The setting to check.
  
          Returns:
              object: The unmodified object if it's the proper type.
  
          Raises:
              ValueError: If the setting is the wrong type.
          """
          if setting is not None and not isinstance(setting, t):
              raise ValueError('"{}" is not "{}"'.format(setting, t))
          return setting
      return _validate
docs: Create a validator that checks if a setting is either None or a given type.
  
      Args:
          t: The type to assert.
  
      Returns:
          callable: A callable that will validate a setting for that type.