code: def get_date_by_shift(
      trading_date,
      shift,
      future=False,
      clip_shift=True,
      freq="day",
      align: Optional[str] = None,
  ):
      """get trading date with shift bias will cur_date
          e.g. : shift == 1,  return next trading date
                 shift == -1, return previous trading date
      ----------
      trading_date : pandas.Timestamp
          current date
      shift : int
      clip_shift: bool
      align : Optional[str]
          When align is None, this function will raise ValueError if `trading_date` is not a trading date
          when align is "left"/"right", it will try to align to left/right nearest trading date before shifting when `trading_date` is not a trading date
  
      """
      from qlib.data import D  # pylint: disable=C0415
  
      cal = D.calendar(future=future, freq=freq)
      trading_date = pd.to_datetime(trading_date)
      if align is None:
          if trading_date not in list(cal):
              raise ValueError(
                  "{} is not trading day!".format(str(trading_date))
              )
          _index = bisect.bisect_left(cal, trading_date)
      elif align == "left":
          _index = bisect.bisect_right(cal, trading_date) - 1
      elif align == "right":
          _index = bisect.bisect_left(cal, trading_date)
      else:
          raise ValueError(
              f"align with value `{align}` is not supported"
          )
      shift_index = _index + shift
      if shift_index < 0 or shift_index >= len(cal):
          if clip_shift:
              shift_index = np.clip(shift_index, 0, len(cal) - 1)
          else:
              raise IndexError(
                  f"The shift_index({shift_index}) of the trading day ({trading_date}) is out of range"
              )
      return cal[shift_index]
  
imports: from __future__ import division
  from __future__ import print_function
  import os
  import re
  import copy
  import json
  import yaml
  import redis
  import bisect
  import struct
  import difflib
  import inspect
  import hashlib
  import datetime
  import requests
  import collections
  import numpy
  import pandas
  from pathlib import Path
  from typing import List, Union, Optional, Callable
  from packaging import version
  from .file import get_or_create_path, save_multiple_parts_file, unpack_archive_with_buffer, get_tmp_file_with_buffer
  from ..config import C
  from ..log import get_module_logger, set_log_with_config
  from .mod import get_module_by_module_path, split_module_path, get_callable_kwargs, get_cls_kwargs, init_instance_by_config, class_casting
label_desc: Use image node_id 21 for calling a global function with example usage: get_date_by_shift(trading_date, shift, future, clip_shift, freq, align) and returns: cal