def METHOD_NAME(track, groups):
    """
    Given an array of groups, sets them on a track
    Returns true if successful, false if there was an error
    """
    grouping = ' '.join(sorted('_'.join(group.split()) for group in groups))
    track.set_tag_raw(get_tagname(), grouping)
    if not track.write_tags():
        dialogs.error(
            None,
            "Error writing tags to %s"
            % GObject.markup_escape_text(track.get_loc_for_io()),
        )
        return False
    return True