human
Here's a good function header given the following:
I wrote the below code

    from pandas import Index, Categorical, CategoricalIndex, Series
    if (len(to_union) == 0):
        raise ValueError('No    Categoricals    to    union')
    def _maybe_unwrap(x):
        if isinstance(x, (CategoricalIndex, Series)):
            return x.values
        elif isinstance(x, Categorical):
            return x
        else:
            raise TypeError('all    components    to    combine    must    be    Categorical')
    to_union = [_maybe_unwrap(x) for x in to_union]
    first = to_union[0]
    if (not all((is_dtype_equal(other.categories.dtype, first.categories.dtype) for other in to_union[1:]))):
        raise TypeError('dtype    of    categories    must    be    the    same')
    ordered = False
    if all((first.is_dtype_equal(other) for other in to_union[1:])):
        categories = first.categories
        ordered = first.ordered
        new_codes = np.concatenate([c.codes for c in to_union])
        if (sort_categories and (not ignore_order) and ordered):
            raise TypeError('Cannot    use    sort_categories=True    with    ordered    Categoricals')
        if (sort_categories and (not categories.is_monotonic_increasing)):
            categories = categories.sort_values()
            indexer = categories.get_indexer(first.categories)
            from pandas.core.algorithms import take_1d
            new_codes = take_1d(indexer, new_codes, fill_value=(-1))
    elif (ignore_order or all(((not c.ordered) for c in to_union))):
        cats = first.categories.append([c.categories for c in to_union[1:]])
        categories = Index(cats.unique())
        if sort_categories:
            categories = categories.sort_values()
        new_codes = []
        for c in to_union:
            if (len(c.categories) > 0):
                indexer = categories.get_indexer(c.categories)
                from pandas.core.algorithms import take_1d
                new_codes.append(take_1d(indexer, c.codes, fill_value=(-1)))
            else:
                new_codes.append(c.codes)
        new_codes =...

What's a good function header?
assistant
#Here's a good function header.

def union_categoricals(to_union, sort_categories=False, ignore_order=False):