code: def _maybe_update_symbol_frame(
      self,
      start_time,
      api_key,
      cache,
      symbol,
      calendar,
      start_session,
      end_session,
      data_frequency,
      retries,
  ):
      # Attempt to load pre-existing symbol data from cache.
      key = "{sym}.{freq}.frame".format(sym=symbol, freq=data_frequency)
      try:
          raw_data = cache[key]
      except KeyError:
          raw_data = None
  
      # Select the most recent date in cached dataset if it exists,
      # otherwise use the provided `start_session`.
      last = start_session
      if raw_data is not None and len(raw_data) > 0:
          last = raw_data.index[-1].tz_localize("UTC")
  
      should_sleep = False
  
      # Determine time at which cached data will be considered stale.
      cache_expiration = last + pd.Timedelta(days=2)
      if start_time <= cache_expiration and raw_data is not None:
          # Data is fresh enough to reuse, no need to update. Iterator can
          # proceed to next symbol directly since no API call was required.
          return raw_data, should_sleep
  
      # If we arrive here, we must have attempted an API call.
      # Setting this flag tells the iterator to pause before starting
      # the next asset, that we don't exceed the data source's rate
      # limit.
      should_sleep = True
  
      raw_data = self._fetch_symbol_frame(
          api_key,
          symbol,
          calendar,
          start_session,
          end_session,
          data_frequency,
          retries=retries,
      )
  
      # Cache latest symbol data.
      cache[key] = raw_data
  
      return raw_data, should_sleep
  
imports: from itertools import count
  import tarfile
  from time import sleep
  from abc import abstractmethod, abstractproperty
  import logbook
  import pandas
  from .None import core
  from catalyst.utils.cli import item_show_count, maybe_show_progress
  from catalyst.utils.memoize import lazyval
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 25 for calling the BaseBundle obj's underlying member method code with example usage: obj._maybe_update_symbol_frame(start_time, api_key, cache, symbol, calendar, start_session, end_session, data_frequency, retries) and returns: raw_data,  should_sleep, raw_data,  should_sleep