def _is_batch_all(batch, predicate):
 assert (not isinstance(batch, list))
 if ((batch is None) or (isinstance(batch, tuple) and (len(batch) == 0))):
  return True
 if isinstance(batch, tuple):
  subbatch_results = tuple((_is_batch_all(b, predicate) for b in batch))
  result = all(subbatch_results)
  assert (result == any(subbatch_results)), 'composite batch had a mixture of numeric and symbolic subbatches. This should never happen.'
  return result
 else:
  return predicate(batch)

def _is_batch_all ( batch , predicate ) : assert ( not isinstance ( batch , list ) ) if ( ( batch is None ) or ( isinstance ( batch , tuple ) and ( len ( batch ) == 0 ) ) ) : return True if isinstance ( batch , tuple ) : subbatch_results = tuple ( ( _is_batch_all ( b , predicate ) for b in batch ) ) result = all ( subbatch_results ) assert ( result == any ( subbatch_results ) ) , 'composite batch had a mixture of numeric and symbolic subbatches. This should never happen.' return result else : return predicate ( batch )
implementation of is_symbolic_batch() and is_numeric_batch() .