def ind_for_depth(depth, mesh):
    """
    Find the model depth index that is closest to the required depth

    Parameters
    ----------
    depth : float
        desired depth.
    mesh : object
        FESOM mesh object

    Returns
    dind : int
        index that corresponds to the model depth level closest to `depth`.
    -------
    """
    arr = [abs(abs(z) - abs(depth)) for z in mesh.zlev]
    v, i = min((v, i) for (i, v) in enumerate(arr))
    dind = i
    return dind