def apply_column_rule(row, rule):
    """
    Given a cell value and a rule, return a format name. See `create_cell_formats` for more detail.
    """
    rule_type = rule['type']
    if rule_type == 'all':
        return rule['format']
    if rule_type == 'boolean':
        if rule['function'](row):
            return rule['format']
        else:
            return None
    if rule_type == 'conditional':
        return rule['function'](row)
    raise ValueError(f"Column rule type <{rule['type']}> not supported")