code: def _get_stack_frame(stacklevel):
      
      stacklevel = stacklevel + 1
      if stacklevel <= 1 or _is_internal_frame(sys._getframe(1)):
          # If frame is too small to care or if the warning originated in
          # internal code, then do not try to hide any frames.
          frame = sys._getframe(stacklevel)
      else:
          frame = sys._getframe(1)
          # Look for one frame less since the above line starts us off.
          for x in range(stacklevel-1):
              frame = _next_external_frame(frame)
              if frame is None:
                  raise ValueError
      return frame
docs: utility functions to get a stackframe, skipping internal frames.