code: def kday_on_before(rdate, k):
      r"""Calculate the day on or before a given RDate.
  
      Parameters
      ----------
      rdate : int
          RDate date format.
      k : int
          Day of the week.
  
      Returns
      -------
      kdob : int
          kday-on-or-before in RDate format.
      """
      kdob = rdate - day_of_week(rdate - k)
      return kdob
  
imports: import calendar
  import logging
  import math
  import pandas
label_desc: Use image node_id 15 for calling a global function with example usage: kday_on_before(rdate, k) and returns: kdob