code: def prepare(um, today, user_id, exchange_config=None):
      """
      1. Get the dates that need to do trading till today for user {user_id}
          dates[0] indicate the latest trading date of User{user_id},
          if User{user_id} haven't do trading before, than dates[0] presents the init date of User{user_id}.
      2. Set the exchange with exchange_config file
  
          Parameter
              um : UserManager()
              today : pd.Timestamp()
              user_id : str
          :return
              dates : list of pd.Timestamp
              trade_exchange : Exchange()
      """
      # get latest trading date for {user_id}
      # if is None, indicate it haven't traded, then last trading date is init date of {user_id}
      latest_trading_date = um.users[user_id].get_latest_trading_date()
      if not latest_trading_date:
          latest_trading_date = um.user_record.loc[user_id][0]
  
      if str(today.date()) < latest_trading_date:
          log.warning(
              "user_id:{}, last trading date {} after today {}".format(
                  user_id, latest_trading_date, today
              )
          )
          return [pd.Timestamp(latest_trading_date)], None
  
      dates = D.calendar(
          start_time=pd.Timestamp(latest_trading_date),
          end_time=pd.Timestamp(today),
          future=True,
      )
      dates = list(dates)
      dates.append(get_next_trading_date(dates[-1], future=True))
      if exchange_config:
          with pathlib.Path(exchange_config).open("r") as fp:
              exchange_paras = yaml.safe_load(fp)
      else:
          exchange_paras = {}
      trade_exchange = Exchange(trade_dates=dates, **exchange_paras)
      return dates, trade_exchange
  
file_path: qlib/qlib/contrib/online/utils.py
imports: import pathlib
  import pickle
  import yaml
  import pandas
  from ...data import D
  from ...config import C
  from ...log import get_module_logger
  from ...utils import get_next_trading_date
  from ...backtest.exchange import Exchange
label_desc: Use image node_id 4 for calling a global function with example usage: prepare(um, today, user_id, exchange_config) and returns: dates,  trade_exchange, list,  None