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