code: def next_event(rdate, events):
      r"""Find the next event after a given date.
  
      Parameters
      ----------
      rdate : int
          RDate date format.
      events : list of RDate (int)
          Monthly events in RDate format.
  
      Returns
      -------
      event : RDate (int)
          Next event in RDate format.
      """
      try:
          event = next(e for e in events if e > rdate)
      except:
          event = 0
      return event
  
imports: import calendar
  import logging
  import math
  import pandas
label_desc: Use image node_id 18 for calling a global function with example usage: next_event(rdate, events) and returns: event