code: def _ensure_values(data: Mapping[str, Any]) -> Tuple[Dict[str, Any], bool]:
      
      to_return = {}
      should_write = False
      for keyname, typekind, default in REQUIRED_DATA:
          if keyname not in data:
              LOG.debug(f"Defaulted config value {keyname} to {default}")
              to_return[keyname] = default
              should_write = True
          elif not isinstance(data[keyname], typekind):
              LOG.warning(
                  f"Config value {keyname} was {type(data[keyname])} not"
                  f" {typekind}, defaulted to {default}")
              to_return[keyname] = default
              should_write = True
          else:
              to_return[keyname] = data[keyname]
      return to_return, should_write
docs: Make sure we have appropriate keys and say if we should write