import math


def xy_to_bearing(x, y):
    """
    converts coordinates x, y into absolute bearing in range [0, 360)
    for example (x=0, y=1) => 0, (x=1, y=0) => 90, (x=0, y=-1) => 180, (x=-1, y=0) => 270
    """
    if x == 0.0 and y == 0.0:
        return None

    b = math.degrees(math.atan2(x, y))
    b = b if b >= 0.0 else b + 360.0
    b = b if b < 360.0 else b - 360.0
    return b