def _make_filetags(attributes, default_filetag = None):
    """Helper function for rendering RPM spec file tags, like

    ```
    %attr(0755, root, root) %dir
    ```
    """
    template = "%attr({mode}, {user}, {group}) {supplied_filetag}"

    mode = attributes.get("mode", "-")
    user = attributes.get("user", "-")
    group = attributes.get("group", "-")

    supplied_filetag = attributes.get("rpm_filetag", default_filetag)

    return template.format(
        mode = mode,
        user = user,
        group = group,
        supplied_filetag = supplied_filetag or "",
    )