def _untransform(orig_xy, screen_xy, ax):
    """
    Return data coordinates to place an annotation at screen coordinates
    *screen_xy* in axes *ax*.

    *orig_xy* are the "original" coordinates as stored by the artist; they are
    transformed to *screen_xy* by whatever transform the artist uses.  If the
    artist uses ``ax.transData``, just return *orig_xy*; else, apply
    ``ax.transData.inverse()`` to *screen_xy*.  (The first case is more
    accurate than always applying ``ax.transData.inverse()``.)
    """
    tr_xy = ax.transData.transform(orig_xy)
    return (
        orig_xy
        if ((tr_xy == screen_xy) | np.isnan(tr_xy) & np.isnan(screen_xy)).all()
        else ax.transData.inverted().transform(screen_xy))