def _get_label_values(func, use_apply, name_and_group):
    """
    Returns a tuple of a name, func(group) for this name_and_group.
    Used since .groupby() returns an iterator over the pairs (name, group).

    Parameters
    ----------
    func : Function
        Must be picklable:  A lambda function will not work!
    name_and_group : Tuple
        name, group
    use_apply : Boolean
        If True, use group.apply(func)
        If False, use func(group)

    Returns
    -------
    name : the group name/label
        Same as the 'name' passed in
    value : Either group.apply(func) or func(group)
    """
    name, group = name_and_group

    value = group.apply(func) if use_apply else func(group)

    return name, value