def add_xy(ndarray, xy_pair):
    """ Add (x,y) to ndarray.  Array can be of dimentsion N,2 or 2,N """
    try:
        return ndarray + xy_pair
    except ValueError:
        return (ndarray.T + xy_pair).T