def METHOD_NAME(base, what, where, highlevel, behavior):
    if not (
        where is None
        or isinstance(where, str)
        or (
            is_non_string_like_sequence(where)
            and all(isinstance(x, str) for x in where)
        )
    ):
        raise TypeError(
            "New fields may only be assigned by field name(s) "
            "or as a new integer slot by passing None for 'where'"
        )
    if is_non_string_like_sequence(where) and len(where) > 1:
        return METHOD_NAME(
            base,
            METHOD_NAME(
                base[where[0]],
                what,
                where[1:],
                highlevel,
                behavior,
            ),
            where[0],
            highlevel,
            behavior,
        )
    else:
        # If we have an iterable here, pull out the only ti
        if is_non_string_like_sequence(where):
            where = where[0]
        behavior = behavior_of(base, what, behavior=behavior)
        backend = backend_of(base, what, default=cpu, coerce_to_common=True)
        base = ak.operations.to_layout(
            base, allow_record=True, allow_other=False
        ).to_backend(backend)
        what = ak.operations.to_layout(what, allow_record=True, allow_other=True)
        if isinstance(what, (ak.contents.Content, ak.record.Record)):
            what = what.to_backend(backend)
        keys = copy.copy(base.fields)
        if where in base.fields:
            keys.remove(where)
        def purelist_is_record(layout):
            result = False
            def action_is_record(input, **kwargs):
                nonlocal result
                if input.is_record:
                    result = True
                    return input
                elif input.is_union:
                    result = all(purelist_is_record(x) for x in input.contents)
                    return input
                else:
                    return None
            ak._do.recursively_apply(layout, action_is_record, return_array=False)
            return result
        if not purelist_is_record(base):
            raise ValueError("no tuples or records in array; cannot add a new field")
        def action(inputs, **kwargs):
            base, what = inputs
            backend = base.backend
            if isinstance(base, ak.contents.RecordArray):
                if what is None:
                    what = ak.contents.IndexedOptionArray(
                        ak.index.Index64(
                            backend.index_nplike.full(base.length, -1, dtype=np.int64),
                            nplike=backend.index_nplike,
                        ),
                        ak.contents.EmptyArray(),
                    )
                elif not isinstance(what, ak.contents.Content):
                    what = ak.contents.NumpyArray(
                        backend.nplike.repeat(
                            backend.nplike.asarray(what),
                            backend.nplike.shape_item_as_index(base.length),
                        )
                    )
                if base.is_tuple:
                    # Preserve tuple-ness
                    if where is None:
                        fields = None
                    # Otherwise the tuple becomes a record
                    else:
                        fields = [*keys, where]
                # Records with `where=None` will create a tuple-like key
                elif where is None:
                    fields = [*keys, str(len(keys))]
                else:
                    fields = [*keys, where]
                out = ak.contents.RecordArray(
                    [base[k] for k in keys] + [what],
                    fields,
                    parameters=base.parameters,
                )
                return (out,)
            else:
                return None
        out = ak._broadcasting.broadcast_and_apply(
            [base, what],
            action,
            behavior,
            right_broadcast=False,
        )
        assert isinstance(out, tuple) and len(out) == 1
        return wrap_layout(out[0], behavior, highlevel)