code: def checkdate(dt, d):
      # Check if the date is in the week where the 3rd friday of Mar/Jun/Sep/Dec
  
      # EuroStoxx50 expiry codes: MY
      # M -> H, M, U, Z (Mar, Jun, Sep, Dec)
      # Y -> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -> year code. 5 -> 2015
      MONTHS = dict(H=3, M=6, U=9, Z=12)
  
      M = MONTHS[d._dataname[-2]]
  
      centuria, year = divmod(dt.year, 10)
      decade = centuria * 10
  
      YCode = int(d._dataname[-1])
      Y = decade + YCode
      if Y < dt.year:  # Example: year 2019 ... YCode is 0 for 2023
          Y += 10
  
      exp_day = 21 - (calendar.weekday(Y, M, 1) + 2) % 7
      exp_dt = datetime.datetime(Y, M, exp_day)
  
      # Get the year, week numbers
      exp_year, exp_week, _ = exp_dt.isocalendar()
      dt_year, dt_week, _ = dt.isocalendar()
  
      # print('dt {} vs {} exp_dt'.format(dt, exp_dt))
      # print('dt_week {} vs {} exp_week'.format(dt_week, exp_week))
  
      # can switch if in same week
      return (dt_year, dt_week) == (exp_year, exp_week)
  
file_path: backtrader/samples/rollover/rollover.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import bisect
  import calendar
  import datetime
  import backtrader
label_desc: Use image node_id 1 for calling a global function with example usage: checkdate(dt, d) and returns: unknown