code: def update_step_size(
      error_estimate,
      prev_step_size,
      safety=0.9,
      facmin=0.2,
      facmax=1.4,
      prev_error_ratio=None,
  ):
      """Adaptively propose the next step size based on estimated errors."""
      if error_estimate > 1:
          pfactor = 0
          ifactor = 1 / 1.5  # 1 / 5
      else:
          pfactor = 0.13
          ifactor = 1 / 4.5  # 1 / 15
  
      error_ratio = safety / error_estimate
      if prev_error_ratio is None:
          prev_error_ratio = error_ratio
      factor = (
          error_ratio**ifactor
          * (error_ratio / prev_error_ratio) ** pfactor
      )
      if error_estimate <= 1:
          prev_error_ratio = error_ratio
          facmin = 1.0
      factor = min(facmax, max(facmin, factor))
      new_step_size = prev_step_size * factor
      return new_step_size, prev_error_ratio
  
imports: import torch
  from .None import misc
  from ..types import TensorOrTensors
label_desc: Use image node_id 1 for calling a global function with example usage: update_step_size(error_estimate, prev_step_size, safety, facmin, facmax, prev_error_ratio) and returns: new_step_size,  prev_error_ratio