code: def compute_scale(
      min_, max_, logarithmic, order_min, min_scale, max_scale
  ):
      """Compute an optimal scale between min and max"""
      if min_ == 0 and max_ == 0:
          return [0]
      if max_ - min_ == 0:
          return [min_]
      if logarithmic:
          log_scale = compute_logarithmic_scale(
              min_, max_, min_scale, max_scale
          )
          if log_scale:
              return log_scale
              # else we fallback to normal scalling
  
      order = round(log10(max(abs(min_), abs(max_)))) - 1
      if order_min is not None and order < order_min:
          order = order_min
      else:
          while (max_ - min_) / (10**order) < min_scale and (
              order_min is None or order > order_min
          ):
              order -= 1
      step = float(10**order)
      while (max_ - min_) / step > max_scale:
          step *= 2.0
      positions = []
      position = round_to_scale(min_, step)
      while position < (max_ + step):
          rounded = round_to_scale(position, step)
          if min_ <= rounded <= max_:
              if rounded not in positions:
                  positions.append(rounded)
          position += step
      if len(positions) < 2:
          return [min_, max_]
      return positions
  
imports: from __future__ import division
  import re
  from decimal import Decimal
  from math import ceil, cos, floor, log10, pi, sin
label_desc: Use image node_id 12 for calling a global function with example usage: compute_scale(min_, max_, logarithmic, order_min, min_scale, max_scale) and returns: positions, list, list, list, log_scale