#! /usr/bin/env python2

import sys
import pdb
import traceback

def boom(depth=0):
  # print depth
  try:
    x = 0/0
  except Exception as e:
    print 'Caught {e!r}'.format(**locals())
    (exc_type, exc_value, exc_traceback) = sys.exc_info()
    # pdb.set_trace()
    stack = traceback.format_tb(exc_traceback)
    print(stack)
    for curr in stack:
      sys.stdout.write('traceback stack: {curr!r}\n'.format(**locals()))

def kaboom():
  boom()

kaboom()
