code: def get_text_position(text, ax=None):
      ax = ax or plt.gca()
      x, y = text.get_position()
      return (ax.xaxis.convert_units(x), ax.yaxis.convert_units(y))
  
imports: from __future__ import division
  import sys
  from itertools import product
  from operator import itemgetter
  import matplotlib
  import numpy
  from matplotlib import pyplot
  from matplotlib.path import get_path_collection_extents
label_desc: Use image node_id 2 for calling a global function with example usage: get_text_position(text, ax) and returns: ax,  ax