code: def check_warnings(warnNumber, buffer):
      warn_phrase = "UserWarning"
      warn_string_of_interest = "slash (/) found"
      sys.stderr = (
          sys.__stderr__
      )  # redirect printout back to normal path
  
      try:  # for python 2.7
          assert len(buffer.buflist) == warnNumber
          if (
              len(buffer.buflist) > 0
          ):  # check to make sure we have the right number of warning
              for index in range(len(buffer.buflist)):
                  print(
                      "*** captured warning message: {0}".format(
                          buffer.buflist[index]
                      )
                  )
                  assert (warn_phrase in buffer.buflist[index]) and (
                      warn_string_of_interest in buffer.buflist[index]
                  )
      except:  # for python 3.
          warns = buffer.getvalue()
          print("*** captured warning message: {0}".format(warns))
          countWarns = warns.count("UserWarning")
          assert (
              countWarns == warnNumber
          ), "Expected number of warnings: {0}, but received {1}.".format(
              warnNumber, countWarns
          )
  
imports: import sys
  import h2o
  from tests import pyunit_utils
label_desc: Use image node_id 2 for calling a global function with example usage: check_warnings(warnNumber, buffer) without return types