Currently the section ending for the orbital occupancy is found in a very flaky way.
Usually the lines look like: 994 H 116 S Ryd( 2S) 0.00288 0.53112
An improved way of finding the correct ending is to strip and process each item of the line of the section into a list until the 3rd item (the atom's index, 116 in this case) is not equal to the amount of atoms in the molecule anymore. Or if an error is raised in the stripping and processing of the line.
This update would need a significant overhaul of the extract_donor_lone_pair_occupancy function in dft_extraction though.