def normal_from_lineseg(seg):
    """ Returns a normal vector with respect to the given line segment. """
    
    start, end = seg
    
    x1, y1 = start
    x2, y2 = end
    
    dx = x2 - x1
    dy = y2 - y1
    
    return (dy, -dx)