def fastaIterator(fn, useMutableString=False, verbose=False):
  """
    A generator function which yields fastaSequence objects from a fasta-format
    file or stream.

    :param fn: a file-like stream or a string; if this is a string, it's
               treated as a filename, else it's treated it as a file-like
               object, which must have a readline() method.
    :param useMustableString: if True, construct sequences from lists of chars,
                              rather than python string objects, to allow
                              more efficient editing. Use with caution.
    :param verbose: if True, output additional status messages to stderr about
                    progress
  """
  fh = fn
  if type(fh).__name__ == "str":
    fh = open(fh)

  if verbose:
    try:
      pind = __build_progress_indicator(fh)
    except ProgressIndicatorError as e:
      sys.stderr.write("Warning: unable to show progress for stream. " +
                       "Reason: " + str(e))
      verbose = False

  prev_line = None
  while True:
    seqHeader = __read_seq_header(fh, prev_line)
    name = seqHeader[1:].strip()
    seq_data, prev_line = __read_seq_data(fh)
    if verbose:
      pind.done = fh.tell()
      pind.showProgress(to_strm=sys.stderr)
    yield Sequence(name, seq_data, useMutableString)

    # remember where we stopped for next call, or finish
    if prev_line == "":
      break