code: def forward_fill_df_if_needed(df, periods):
      df = df.reindex(periods)
      # volume should always be 0 (if there were no trades in this interval)
      df["volume"] = df["volume"].fillna(0.0)
      # ie pull the last close into this close
      df["close"] = df.fillna(method="pad")
      # now copy the close that was pulled down from the last timestep
      # into this row, across into o/h/l
      df["open"] = df["open"].fillna(df["close"])
      df["low"] = df["low"].fillna(df["close"])
      df["high"] = df["high"].fillna(df["close"])
      return df
  
imports: import hashlib
  import json
  import os
  import pickle
  import shutil
  from datetime import date, datetime
  import pandas
  from catalyst.assets._assets import TradingPair
  from six import string_types
  from six.moves.urllib import request
  from catalyst.constants import DATE_FORMAT, SYMBOLS_URL
  from catalyst.exchange.exchange_errors import ExchangeSymbolsNotFound
  from catalyst.exchange.utils.serialization_utils import ExchangeJSONEncoder, ExchangeJSONDecoder
  from catalyst.utils.memoize import weak_lru_cache
  from catalyst.utils.paths import data_root, ensure_directory, last_modified_time
label_desc: Use image node_id 31 for calling a global function with example usage: forward_fill_df_if_needed(df, periods) and returns: df