def delay_exponential(base, growth_factor, attempts):
 if (base == 'rand'):
  base = random.random()
 elif (base <= 0):
  raise ValueError(("The 'base' param must be greater than 0, got: %s" % base))
 time_to_sleep = (base * (growth_factor ** (attempts - 1)))
 return time_to_sleep

def delay_exponential ( base , growth_factor , attempts ) : if ( base == 'rand' ) : base = random . random ( ) elif ( base <= 0 ) : raise ValueError ( ( "The 'base' param must be greater than 0, got: %s" % base ) ) time_to_sleep = ( base * ( growth_factor ** ( attempts - 1 ) ) ) return time_to_sleep
calculate time to sleep based on exponential function .