<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _ensure_values(data: Mapping[str, Any]) -> Tuple[Dict[str, Any], bool]: """ Make sure we have appropriate keys and say if we should write """

    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