docs: def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0):
      """Return text position inside of the given axis"""
      ## Check and preprocess input arguments
      try: pad_scale = float(pad_scale)
      except: raise TypeError("'pad_scale should be of type 'float'")
          
      for arg in [va, ha]: 
          assert type(arg) is str
          arg = arg.lower() # Make it lowercase to prevent case problem.
      
      ## Get axis size in inches
      ax_height, ax_width = get_ax_size_in_inch(fig, ax)
      
      ## Construct inversion factor from inch to plot coordinate
      length_x = ax.get_xlim()[1] - ax.get_xlim()[0]
      length_y = ax.get_ylim()[1] - ax.get_ylim()[0]
      inch2coord_x = length_x / ax_width
      inch2coord_y = length_y / ax_height
      
      ## Set padding size relative to the text size
      #pad_inch = text_bbox_inch.height * pad_scale
      #pad_inch = fontsize_points * point2inch * pad_scale
      ax_length_geom_average = (ax_height * ax_width) ** 0.5
      pad_inch = ax_length_geom_average * 0.03 * pad_scale
      pad_inch_x, pad_inch_y = pad_inch, pad_inch
      
      pad_coord_x = pad_inch_x * inch2coord_x
      pad_coord_y = pad_inch_y * inch2coord_y
      
      if ha == 'left': pos_x = ax.get_xlim()[0] + pad_coord_x
      elif ha == 'right': pos_x = ax.get_xlim()[1] - pad_coord_x
      else: raise Exception("Unsupported value for 'ha'")
      
      if va in ['top','up','upper']: pos_y = ax.get_ylim()[1] - pad_coord_y
      elif va in ['bottom','down','lower']: pos_y = ax.get_ylim()[0] + pad_coord_y
      else: raise Exception("Unsupported value for 'va'")
      
      return pos_x, pos_y