def CheckFlowErrors(total_flows, token=None):
  # Check that all the flows are complete.
  for session_id in total_flows:
    try:
      flow_obj = aff4.FACTORY.Open(session_id, aff4_type="GRRFlow", mode="r",
                                   token=token)
    except __HOLE__:
      continue

    if flow_obj.state.context.state != rdf_flows.Flow.State.TERMINATED:
      if flags.FLAGS.debug:
        pdb.set_trace()
      raise RuntimeError("Flow %s completed in state %s" % (
          flow_obj.state.context.args.flow_name,
          flow_obj.state.context.state))
dataset/ETHPy150Open google/grr/grr/lib/test_lib.py/CheckFlowErrors