You should be able to use scikit-bio's `parse_fasta` function to do most of the parsing for you, and then you can do additional parsing of each sequence ID that `parse_fasta` yields.