code: def tune_scale(acceptance, scale):
               
  
          if acceptance > 0.8:
              scale *= 2.0
          elif acceptance <= 0.8 and acceptance > 0.4:
              scale *= 1.3            
          elif acceptance < 0.234 and acceptance > 0.1:
              scale *= (1/1.3)
          elif acceptance <= 0.1 and acceptance > 0.05:
              scale *= 0.4
          elif acceptance <= 0.05 and acceptance > 0.01:
              scale *= 0.2
          elif acceptance <= 0.01:
              scale *= 0.1
          return scale
docs: Tunes scale for M-H algorithm
  
          Parameters
          ----------
          acceptance : float
              The most recent acceptance rate
  
          scale : float
              The current scale parameter
  
          Returns
          ----------
          scale : float
              An adjusted scale parameter
  
          Notes
          ----------
          Ross : Initially did this by trial and error, then refined by looking at other
          implementations, so some credit here to PyMC3 which became a guideline for this.