code: def retry(
      f,
      no_retries=5,
      sleep_time=1,
      exception_class=BaseException,
      logger=None,
  ):
      for i in range(no_retries):
          try:
              return f()
          except exception_class as exc:
              check_for_kb_interrupt()
              if i == no_retries - 1:
                  raise exc
  
              if logger:
                  logger.info(
                      (
                          "Exception {0} is caught, "
                          + "sleeping {1}s and retrying (attempt {2} of {3})"
                      ).format(exc, sleep_time, i, no_retries)
                  )
              time.sleep(sleep_time)
      return None
  
imports: import hashlib
  from io import StringIO
  from datetime import timedelta
  import re
  import random
  import string
  import time
  import sys
  import shutil
  import shlex
  import os
  import tempfile
  import uuid
label_desc: Use image node_id 8 for calling a global function with example usage: retry(f, no_retries, sleep_time, exception_class, logger) and returns: None, f