code: def retry(tries, delay=0, back_off=1, raise_msg=''):
      
  
      if back_off < 1:
          raise ValueError('back_off must be 1 or greater')
  
      tries = math.floor(tries)
      if tries < 0:
          raise ValueError('tries must be 0 or greater')
  
      if delay < 0:
          raise ValueError('delay must be 0 or greater')
  
      def deco_retry(f):
          def f_retry(*args, **kwargs):
              max_tries, max_delay = tries, delay  # make mutable
  
              while max_tries > 0:
                  rv = f(*args, **kwargs)  # first attempt
                  if rv:  # Done on success
                      return rv
  
                  max_tries -= 1  # consume an attempt
                  time.sleep(max_delay)  # wait...
                  max_delay *= back_off  # make future wait longer
              else:
                  if raise_msg:
                      raise Exception(raise_msg)
                  return
  
          return f_retry  # true decorator -> decorated function
  
      return deco_retry
docs: Retries a function or method until it got True.
  
      - ``delay`` sets the initial delay in seconds
      - ``back_off`` sets the factor by which
      - ``raise_msg`` if not '', it'll raise an Exception