def get_stack(context=1):
 frame = sys._getframe(1)
 framelist = []
 while frame:
  framelist.append(((frame,) + getframeinfo(frame, context)))
  frame = frame.f_back
 return framelist

def get_stack ( context = 1 ) : frame = sys . _getframe ( 1 ) framelist = [ ] while frame : framelist . append ( ( ( frame , ) + getframeinfo ( frame , context ) ) ) frame = frame . f_back return framelist
get a list of records for a frame and all higher frames .