code: def _normalize_angle(x, limit):
      
      double_limit = limit * 2.0
      modulo = fmod(x, double_limit) or 0.0  # `or 0` is to turn -0 to +0.
      if modulo < -limit:
          return modulo + double_limit
      if modulo >= limit:
          return modulo - double_limit
      return modulo
docs: Normalize angle `x` to be within `[-limit; limit)` range.