code: def __getOrCreateInstrument(self, instrument):
      # Try to get the instrument id from the cache.
      ret = self.__instrumentIds.get(instrument, None)
      if ret is not None:
          return ret
      # If its not cached, get it from the db.
      ret = self.__findInstrumentId(instrument)
      # If its not in the db, add it.
      if ret is None:
          ret = self.__addInstrument(instrument)
      # Cache the id.
      self.__instrumentIds[instrument] = ret
      return ret
  
imports: from pyalgotrade.barfeed import dbfeed
  from pyalgotrade.barfeed import membf
  from pyalgotrade import bar
  from pyalgotrade.utils import dt
  import sqlite3
  import os
label_desc: Use image node_id 4 for calling the Database obj's underlying member method code with example usage: obj.__getOrCreateInstrument(instrument) and returns: ret, ret