def column_sets(template_version):
    """
    Helper to get required and optional cols from a template
    """
    required = set()
    optional = set()
    for f in template_version.field_definitions["fields"]:
        if f["required"]:
            required.add(f["label"])
        else:
            optional.add(f["label"])
    return required, optional