code: def get_treasury_rate(treasury_curves, treasury_duration, day):
      rate = None
  
      curve = treasury_curves.ix[day]
      # 1month note data begins in 8/2001,
      # so we can use 3month instead.
      idx = TREASURY_DURATIONS.index(treasury_duration)
      for duration in TREASURY_DURATIONS[idx:]:
          rate = curve[duration]
          if rate is not None:
              break
  
      return rate
  
imports: import logbook
  import numpy
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 2 for calling a global function with example usage: get_treasury_rate(treasury_curves, treasury_duration, day) and returns: rate