def insert_leaf(csv_map, name, value, max_depth, current_depth):
    """
    Insert a leaf to its proper csv column, creating it if it does not exist.
    Note that this function will not add a new column if the associated value is None,
    because there's a chance that it may be revealed to be a recursive column in the future.
    :param csv_map:
    :param name:
    :param value:
    :param max_depth:
    :param current_depth:
    :return: True if the given value was added, False otherwise.
    """
    if name not in csv_map:
        if value is None:
            # If this is the first time encountering this name, but its value is None, there is no way to know if it
            # is truly a leaf, so abort.
            return False
        csv_map[name] = [None for _ in range(current_depth)]
        for _ in range(max(max_depth.value - current_depth, 1)):
            csv_map[name].append(value)
    else:
        csv_map[name].append(value)
    return True