def add_data(self, html, key, value): if value is not None: data = html._data if key in data and isinstance(value, Mapping): target = data[key] if isinstance(target, Mapping): return recursive_update(target, value) data[key] = value