code: def parse_traceback(msg, site_path="site-packages", in_app_prefix="c7n"):
      
  
      data = {}
      lines = list(filter(None, msg.split('\n')))
      data['frames'] = []
      err_ctx = None
  
      for l in lines[1:-1]:
          l = l.strip() # noqa E741
          if l.startswith('Traceback'):
              continue
          elif l.startswith('File'):
              abs_path, lineno, function = l.split(',', 3)
              abs_path = abs_path[abs_path.find('"'):-1]
              f_path = abs_path[abs_path.find(site_path) + len(site_path) + 1:]
              module = f_path[:f_path.find('.')].replace('/', '.').strip('.')
              lineno = int(lineno.strip().split()[1])
              function = function.strip().split()[-1]
              err_ctx = dict(lineno=lineno,
                             abs_path=abs_path,
                             function=function,
                             filename=f_path,
                             module=module)
              if module.startswith(in_app_prefix):
                  err_ctx['in_app'] = True
          elif err_ctx is not None:
              err_ctx['context_line'] = l
              data['frames'].append(err_ctx)
              err_ctx = None
  
      return lines[0], {
          'type': lines[-1].strip().split(':')[0],
          'value': lines[-1].strip().split(':', 1)[1].strip(),
          'module': data['frames'][-1]['module'],
          'stacktrace': data}
docs: Extract a sentry traceback structure,
  
      From a python formatted traceback string per python stdlib
      traceback.print_exc()