<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def index(self, value, floating=False):
 """Return the index of a value in the domain. Parameters value : ``self.set`` element Point whose index to find. floating : bool, optional If True, then the index should also give the position inside the voxel. This is given by returning the integer valued index of the voxel plus the distance from the left cell boundary as a fraction of the full cell size. Returns ------- index : int, float, tuple of int or tuple of float Index of the value, as counted from the left. If ``self.ndim > 1`` the result is a tuple, else a scalar. If ``floating=True`` the scalar is a float, else an int. Examples -------- Get the indices of start and end: 0 4 For points inside voxels, the index of the containing cell is returned: 0 By using the ``floating`` argument, partial positions inside the voxels can instead be determined: 0.5 These indices work with indexing, extracting the voxel in which the point lies: uniform_partition(0.0, 0.4, 1) The same principle also works in higher dimensions: (2, 0) uniform_partition([ 0.5, -1. ], [ 0.75, 2. ], (1, 1)) """

        value = np.atleast_1d(self.set.element(value))
        result = []
        for val, cell_bdry_vec in zip(value, self.cell_boundary_vecs):
            ind = np.searchsorted(cell_bdry_vec, val)
            if floating:
                if cell_bdry_vec[ind] == val:
                    # Value is on top of edge
                    result.append(float(ind))
                else:
                    # interpolate between
                    csize = float(cell_bdry_vec[ind] - cell_bdry_vec[ind - 1])
                    result.append(ind - (cell_bdry_vec[ind] - val) / csize)
            else:
                if cell_bdry_vec[ind] == val and ind != len(cell_bdry_vec) - 1:
                    # Value is on top of edge, but not last edge
                    result.append(ind)
                else:
                    result.append(ind - 1)

        if self.ndim == 1:
            result = result[0]
        else:
            result = tuple(result)

        return result