code: def _extract_stack(limit=10):
      
      frame = sys._getframe().f_back
      try:
          stack = traceback.StackSummary.extract(
              traceback.walk_stack(frame), lookup_lines=False)
      finally:
          del frame
  
      apg_path = asyncpg.__path__[0]
      i = 0
      while i < len(stack) and stack[i][0].startswith(apg_path):
          i += 1
      stack = stack[i:i + limit]
  
      stack.reverse()
      return ''.join(traceback.format_list(stack))
docs: Replacement for traceback.extract_stack() that only does the
      necessary work for asyncio debug mode.