code: def func_frame(function_index, function_name=None):
      
      frm = inspect.currentframe()
      if function_name is not None:
          function_name = function_name.split('*')[0]  # todo replace this
                                                       # todo with regex
          for i in range(1000):
              if frm.f_code.co_name.startswith(function_name):
                  break
              frm = frm.f_back
      else:
          for i in range(function_index):
              frm = frm.f_back
      try:  # this is pycharm debugger inserting middleware
          if frm.f_code.co_name == 'run_code':
              frm = frm.f_back
      except:
          pass
      return frm
docs: This will return the class_name and function_name of the
      function traced back two functions.
  
      :param function_index: int of how many frames back the program 
                             should look (2 will give the parent of the caller)
      :param function_name: str of what function to look for (should 
                             not be used with function_index
      :return frame: this will return the frame of the calling function