def METHOD_NAME(blast_out=None, blast_file=None,
    min_identity=None, expect=None, stop_if_no_alignment=True):
  """
  Parse NCBI BLAST XML output and convert to a list of simple summary
  objects.  Note that this is very specific to searching the PDB, and returns
  incomplete information (suitable for summarizing in a flat table).
  """
  assert ([blast_out, blast_file].count(None) == 1)
  from Bio.Blast import NCBIXML
  import iotbx.pdb.fetch
  if (blast_out is not None):
    blast_in = StringIO(blast_out)
  else :
    assert os.path.isfile(blast_file)
    blast_in = open(blast_file)
  parsed = NCBIXML.parse(blast_in)
  blast = next(parsed)
  if (len(blast.alignments) == 0):
    if stop_if_no_alignment:
      raise Sorry("No matching sequences!")
    else: return list()
  results = []
  for i_hit, hit in enumerate(blast.alignments):
    pdb_chain_id = str(hit.accession)
    #hit.accession may only have pdb_id, e.g. 1EMB
    if len(pdb_chain_id.split("_")) > 1:
      pdb_id, chain_id = pdb_chain_id.split("_")
    else:
      pdb_id = pdb_chain_id
      chain_id = None
    #
    hsp = hit.hsps[0]
    assert (hsp.align_length > 0)
    identity = 100 * hsp.identities / hsp.align_length
    if (min_identity is not None) and (identity < min_identity):
      continue
    # XXX this is really appalling, but the NCBI groups together identical
    # sequences in its BLAST output, so I need to parse the accession code
    # strings to extract the individual PDB IDs
    hit_def_fields = hit.hit_def.split("|")
    all_ids = []
    all_ids.append([pdb_id,chain_id])
    for i_field, field in enumerate(hit_def_fields):
      if (field == "pdb") and (i_field < len(hit_def_fields) -1):
        next_pdb_id = hit_def_fields[i_field + 1]
        if "Chain" in hit_def_fields[i_field + 2]:
          next_chain_id = hit_def_fields[i_field + 2].split()[0]
        else:
          next_chain_id = None
        if (iotbx.pdb.fetch.looks_like_pdb_id(next_pdb_id)):
          all_ids.append([next_pdb_id,next_chain_id])
    summary = blast_hit(
      hit_num=i_hit+1,
      pdb_id=pdb_id,
      chain_id=chain_id,
      evalue=hsp.expect,
      length=hsp.align_length,
      identity=identity,
      positives=100*hsp.positives/hsp.align_length,
      hsp = hsp,
      all_ids=all_ids)
    results.append(summary)
  return results