MAINT: f2py: rewrite fortran_doc

This fixes part of #5044. Don't wait for me to fix the whole thing.
Might as well fix the rest of the `} else {` while you are at it ;)