def wrap_heading(current_heading: float, new_heading: float) -> float:
    """Determines the offset between the current and provided heading to adjust
    them such that the normal subtraction between them results in an angle less than
    or equal to 180 degrees."""
    if abs(new_heading - current_heading) > 180:
      if new_heading > current_heading:
        new_heading -= 360

      else:
        new_heading += 360

    return new_heading