code: def get_nth_kday_of_month(gday, gmonth, gyear):
      r"""Convert Gregorian date to RDate format.
  
      Parameters
      ----------
      gday : int
          Gregorian day.
      gmonth : int
          Gregorian month.
      gyear : int
          Gregorian year.
  
      Returns
      -------
      nth : int
          Ordinal number of a given day's occurrence within the month,
          for example, the third Friday of the month.
      """
  
      this_month = calendar.monthcalendar(gyear, gmonth)
      nth_kday_tuple = next(
          (
              (i, e.index(gday))
              for i, e in enumerate(this_month)
              if gday in e
          ),
          None,
      )
      tuple_row = nth_kday_tuple[0]
      tuple_pos = nth_kday_tuple[1]
      nth = tuple_row + 1
      if tuple_row > 0 and this_month[0][tuple_pos] == 0:
          nth -= 1
      return nth
  
imports: import calendar
  import logging
  import math
  import pandas
label_desc: Use image node_id 9 for calling a global function with example usage: get_nth_kday_of_month(gday, gmonth, gyear) and returns: nth