def _write_array(arr, ghosts, stream):
    shape = arr.shape
    if len(shape) > 2:
        imin = ghosts[0]
        jmin = ghosts[2]
        kmin = ghosts[4]
        imax, jmax, kmax = shape
        imax -= ghosts[1]
        jmax -= ghosts[3]
        kmax -= ghosts[5]
        stream.write_floats(arr[imin:imax, jmin:jmax, kmin:kmax], order='Fortran')
    else:
        imin = ghosts[0]
        jmin = ghosts[2]
        imax, jmax = shape
        imax -= ghosts[1]
        jmax -= ghosts[3]
        stream.write_floats(arr[imin:imax, jmin:jmax], order='Fortran')
Write `arr` to `stream`, adjusting for `ghosts`.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/datatypes/domain/plot3d.py/_write_array