from string import Formatter


def _str_template_fields(template):
    """
    Return a list of `str.format` field names in a template string.
    """
    return [
        field_name
        for _, field_name, _, _ in Formatter().parse(template)
        if field_name is not None
    ]