code: def materialize_as_ndarray(a):
      
      if type(a) in (list, tuple):
          if da is not None and any(isinstance(arr, da.Array) for arr in a):
              return da.compute(*a, sync=True)
          return tuple(np.asarray(arr) for arr in a)
      return np.asarray(a)
docs: Convert distributed arrays to ndarrays.