docs: def optimizeAngle(angle):
      """
      Because any rotation can be expressed within 360 degrees
      of any given number, and since negative angles sometimes
      are one character longer than corresponding positive angle,
      we shorten the number to one in the range to [-90, 270[.
      """
      # First, we put the new angle in the range ]-360, 360[.
      # The modulo operator yields results with the sign of the
      # divisor, so for negative dividends, we preserve the sign
      # of the angle.
      if angle < 0:
          angle %= -360
      else:
          angle %= 360
      # 720 degrees is unnecessary, as 360 covers all angles.
      # As "-x" is shorter than "35x" and "-xxx" one character
      # longer than positive angles <= 260, we constrain angle
      # range to [-90, 270[ (or, equally valid: ]-100, 260]).
      if angle >= 270:
          angle -= 360
      elif angle < -90:
          angle += 360
      return angle