def to_rule(palette, group, background, foreground, term):
    """Returns a tuple containing the a highlight function call and its arguments."""
    return (
        "hi",
        group,
        "ctermbg={}".format(palette.get(background, background)),
        "ctermfg={}".format(palette.get(foreground, foreground)),
        "cterm={}".format(palette.get(term, term)))