def _groups_for_user(node, username):
    """
    Returns the list of group names for the given username on the given
    node.
    """
    groups = node.run('id -Gn {}'.format(username)).stdout_text.strip().split(
        ' ')
    primary_group = node.run('id -gn {}'.format(username)).stdout_text.strip()
    groups.remove(primary_group)
    return groups
