def _pick_counters(log_interpretation):
 for log_type in ('step', 'history'):
  counters = log_interpretation.get(log_type, {}).get('counters')
  if counters:
   return counters
 else:
  return {}

def _pick_counters ( log_interpretation ) : for log_type in ( 'step' , 'history' ) : counters = log_interpretation . get ( log_type , { } ) . get ( 'counters' ) if counters : return counters else : return { }
pick counters from a dictionary possibly containing step and history interpretations .