code: def get_stack_frame(N=0, strict=True):
      
      frame_cur = inspect.currentframe()
      for _ix in range(N + 1):
          # always skip the frame of this function
          frame_next = frame_cur.f_back
          if frame_next is None:
              if strict:
                  raise AssertionError('Frame level %r is root' % _ix)
              else:
                  break
          frame_cur = frame_next
      return frame_cur
docs: Args:
          N (int): N=0 means the frame you called this function in.
                   N=1 is the parent frame.
          strict (bool): (default = True)