def METHOD_NAME(
    self, db: Union[DatabaseAPI, ABC_Mutable_Mapping], apply_deletes: bool = True
) -> None:
    """
    Apply the changes in this diff to the given database.
    You may choose to opt out of deleting any underlying keys.
    :param apply_deletes: whether the pending deletes should be
        applied to the database
    """
    for key, value in self._changes.items():
        if value is DELETED:
            if apply_deletes:
                try:
                    del db[key]
                except EVMMissingData:
                    raise
                except KeyError:
                    pass
            else:
                pass
        else:
            db[key] = value  # type: ignore # ignore over cast for perf reasons