code: def resample_history_df(df, freq, field, start_dt=None):
      """
      Resample the OHCLV DataFrame using the specified frequency.
  
      Parameters
      ----------
      df: DataFrame
      freq: str
      field: str
  
      Returns
      -------
      DataFrame
  
      """
      if field == "open":
          agg = "first"
      elif field == "high":
          agg = "max"
      elif field == "low":
          agg = "min"
      elif field == "close":
          agg = "last"
      elif field == "volume":
          agg = "sum"
      else:
          raise ValueError("Invalid field.")
  
      resampled_df = df.resample(freq, closed="left", label="left").agg(
          agg
      )  # type: pd.DataFrame
  
      # Because the samples are closed left, we get one more candle at
      # the beginning then the requested number for bars. Removing this
      # candle to avoid confusion.
      if start_dt and not resampled_df.empty:
          resampled_df = resampled_df[resampled_df.index >= start_dt]
  
      return resampled_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 26 for calling a global function with example usage: resample_history_df(df, freq, field, start_dt) and returns: resampled_df