

def get_slice_bound(self, label, side, kind):
    "\n        Calculate slice bound that corresponds to given label.\n\n        Returns leftmost (one-past-the-rightmost if ``side=='right'``) position\n        of given label.\n\n        Parameters\n        ----------\n        label : object\n        side : {'left', 'right'}\n        kind : {'ix', 'loc', 'getitem'}\n\n        "
    assert (kind in ['ix', 'loc', 'getitem', None])
    if (side not in ('left', 'right')):
        raise ValueError(("Invalid value for side kwarg, must be either 'left' or 'right': %s" % (side,)))
    original_label = label
    label = self._maybe_cast_slice_bound(label, side, kind)
    try:
        slc = self.get_loc(label)
    except KeyError as err:
        try:
            return self._searchsorted_monotonic(label, side)
        except ValueError:
            raise err
    if isinstance(slc, np.ndarray):
        if is_bool_dtype(slc):
            slc = lib.maybe_booleans_to_slice(slc.view('u1'))
        else:
            slc = lib.maybe_indices_to_slice(slc.astype('i8'), len(self))
        if isinstance(slc, np.ndarray):
            raise KeyError(('Cannot get %s slice bound for non-unique label: %r' % (err, original_label)))
    if isinstance(slc, slice):
        if (side == 'left'):
            return slc.start
        else:
            return slc.stop
    elif (side == 'right'):
        return (slc + 1)
    else:
        return slc

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index.get_slice_bound/VarMisuse@202/428 `side`->`err`