def METHOD_NAME(self, stream, alignments):
    """Write a file with the alignments, and return the number of alignments.
    alignments - A list or iterator returning Alignment objects
    """
    count = super().METHOD_NAME(stream, alignments)
    if count != 1:
        raise ValueError("Expected to write 1 alignment; wrote %d" % count)
    return count