class_docstr: Find appropriate date and adjust date.
class_docstr_tok: ["Find","appropriate","date","and","adjust","date","."]
docstr: Shift the datatime of segment
  
  If there are None (which indicates unbounded index) in the segment, this method will return None.
  
  Parameters
  ----------
  seg :
      datetime segment
  step : int
      rolling step
  rtype : str
      rolling type ("sliding" or "expanding")
  
  Returns
  --------
  tuple: new segment
  
  Raises
  ------
  KeyError:
      shift will raise error if the index(both start and end) is out of self.cal
docstr_tok: ["Shift","the","datatime","of","segment","If","there","are","None","(","which","indicates","unbounded","index",")","in","the","segment",",","this","method","will","return","None",".","Parameters","--","--","--","--","--","seg",":","datetime","segment","step",":","int","rolling","step","rtype",":","str","rolling","type","(","``","sliding","''","or","``","expanding","''",")","Returns","--","--","--","--","tuple",":","new","segment","Raises","--","--","--","KeyError",":","shift","will","raise","error","if","the","index","(","both","start","and","end",")","is","out","of","self.cal"]
code: def shift(self, seg: tuple, step: int, rtype=SHIFT_SD) -> tuple:
      """
      Shift the datatime of segment
  
      If there are None (which indicates unbounded index) in the segment, this method will return None.
  
      Parameters
      ----------
      seg :
          datetime segment
      step : int
          rolling step
      rtype : str
          rolling type ("sliding" or "expanding")
  
      Returns
      --------
      tuple: new segment
  
      Raises
      ------
      KeyError:
          shift will raise error if the index(both start and end) is out of self.cal
      """
      if isinstance(seg, tuple):
          start_idx, end_idx = self.align_idx(
              seg[0], tp_type="start"
          ), self.align_idx(seg[1], tp_type="end")
          if rtype == self.SHIFT_SD:
              start_idx = self._add_step(start_idx, step)
              end_idx = self._add_step(end_idx, step)
          elif rtype == self.SHIFT_EX:
              end_idx = self._add_step(end_idx, step)
          else:
              raise NotImplementedError(
                  f"This type of input is not supported"
              )
          if start_idx is not None and start_idx > len(self.cals):
              raise KeyError("The segment is out of valid calendar")
          return self.get(start_idx), self.get(end_idx)
      else:
          raise NotImplementedError(
              f"This type of input is not supported"
          )
  
imports: import bisect
  from copy import deepcopy
  import pandas
  from qlib.data import D
  from qlib.utils import hash_args
  from qlib.utils.mod import init_instance_by_config
  from qlib.workflow import R
  from qlib.config import C
  from qlib.log import get_module_logger
  from pymongo import MongoClient
  from pymongo.database import Database
  from typing import Union
  from pathlib import Path
label_desc: Use image node_id 11 for calling the TimeAdjuster obj's underlying member method code with example usage: obj.shift(seg, step, rtype) and returns: self,  self