def _assert_occurrence(src, probe, target, amount=1):
 occ = src.count(probe)
 if (occ > amount):
  msg = 'more than'
 elif (occ < amount):
  msg = 'less than'
 elif (not occ):
  msg = 'no'
 else:
  msg = None
 if msg:
  raise CommandExecutionError('Found {0} expected occurrences in "{1}" expression'.format(msg, target))

def _assert_occurrence ( src , probe , target , amount = 1 ) : occ = src . count ( probe ) if ( occ > amount ) : msg = 'more than' elif ( occ < amount ) : msg = 'less than' elif ( not occ ) : msg = 'no' else : msg = None if msg : raise CommandExecutionError ( 'Found {0} expected occurrences in "{1}" expression' . format ( msg , target ) )
raise an exception .