def _shift(self, shift_set_, cache_context=True):
        """
        see shift - this is the implementation called from C, split
        out so other C functions can call this directly
        """
        # if there's nothing to shift return this context
        if not shift_set_:
            return self

        # check the type of shift_set_ and construct a new ShiftSet if required
        shift_set = cython.declare(ShiftSet)
        if not isinstance(shift_set_, ShiftSet):
            shift_set = ShiftSet(shift_set_)
        else:
            shift_set = shift_set_

        # if a context already exists for this shift set then return it.
        parent = cython.declare(MDFContext)
        parent = self._parent or self
        try:
            shift_key = shift_set._get_shift_key(self)
            return parent._shifted_cache[shift_key]
        except __HOLE__:
            pass

        # return a new shifted context
        return MDFContext(self._now,
                          _shift_parent=self,
                          _shift_set=shift_set,
                          _cache_shifted=cache_context)
dataset/ETHPy150Open manahl/mdf/mdf/context.py/MDFContext._shift