def bearing_turn(b1, b2):
    """ Calculates turn direction between two bearings

    Bearings represents degrees on a compass (0-359). In order to determine if a turn is
    left or right, the angle between b1 and b2 is calculated to determine the direction.

    Args:
        b1: bearing 1
        b2: bearing 2

    Returns:
        A string, ' left ' or ' right '
    """
    if ((((b1 - b2 + 540) % 360) - 180) > 0):
      return " left "
    else:
      return " right "