def flatten_dxarray(listish):
    """Ensure an array-of-refs is not an array-of-arrays.

    Specifically, a list of job outputs might resolve to a list-of-lists if each
    job output is itself a list -- but it's hard to know or handle that until
    the blocking job completes.

    Use this function within the subjob that takes an array as input.
    """
    if not isinstance(listish, list):
        return [listish]
    out = []
    for elem in listish:
        if isinstance(listish, list):
            out.extend(flatten_dxarray(elem))
        else:
            out.append(elem)
    return out