def extract_background_data(background):
 if (not background):
  return None
 step_data = [extract_step_data(step) for step in background.steps]
 return {'meta': {'total': len(background.steps), 'success': sum([s['meta']['success'] for s in step_data]), 'failures': sum([s['meta']['failed'] for s in step_data]), 'skipped': sum([s['meta']['skipped'] for s in step_data]), 'undefined': sum([s['meta']['undefined'] for s in step_data])}, 'steps': step_data}

def extract_background_data ( background ) : if ( not background ) : return None step_data = [ extract_step_data ( step ) for step in background . steps ] return { 'meta' : { 'total' : len ( background . steps ) , 'success' : sum ( [ s [ 'meta' ] [ 'success' ] for s in step_data ] ) , 'failures' : sum ( [ s [ 'meta' ] [ 'failed' ] for s in step_data ] ) , 'skipped' : sum ( [ s [ 'meta' ] [ 'skipped' ] for s in step_data ] ) , 'undefined' : sum ( [ s [ 'meta' ] [ 'undefined' ] for s in step_data ] ) } , 'steps' : step_data }
extract data from a background instance .