(object_map: VisitableMap, callback: Callback)
The callback can return None to leave the key untouched, False to remove
    the key from the array or object, or a non-null V to replace the value.
The callback can return None to leave the key untouched, False to remove
    the key from the array or object, or a non-null V to replace the value.
The callback can return None to leave the key untouched False to remove the key from the array or object or a non - null V to replace the value .
def update_each_key(object_map: VisitableMap, callback: Callback):
    """
    The callback can return None to leave the key untouched, False to remove
    the key from the array or object, or a non-null V to replace the value.
    """

    keys_to_remove: List[str] = []

    for key, value in object_map.copy().items():
        result = callback(value, key)
        if result is False:
            keys_to_remove.append(key)
        elif result is None:
            continue
        else:
            object_map[key] = result
    for k in keys_to_remove:
        object_map.pop(k)
def update_each_key ( object_map : VisitableMap , callback : Callback ) : keys_to_remove : List [ str ] = [ ] for key , value in object_map . copy ( ) . items ( ) : result = callback ( value , key ) if result is False : keys_to_remove . append ( key ) elif result is None : continue else : object_map [ key ] = result for k in keys_to_remove : object_map . pop ( k )