import math
import cmath


def dirN(c):
    """Given a complex number, return its phase as a compass heading"""
    if c is None:
        value = None
    else:
        value = (450 - math.degrees(cmath.phase(c))) % 360.0
    return value