more type hints for io/formats/format.py
another pass to follow-on from #27418
Thanks! Haven't looked in detail yet but FYI I think we'll want to get #27424 in as a precursor. There's some failures showing up in there in the io.formats file so may uncover some others here as well since that's a central module getting touched

Haven't checked failures in that PR in detail yet so if you have time / interest in taking a look would be appreciated thanks @simonjayhawkins if you can address the questions (in this PR) in a followup would be great > thanks @simonjayhawkins if you can address the questions (in this PR) in a followup would be great

no problem. i'm hoping some issues will resolve themselves as more type hints are added to imported functions and the default return type of  `Any` is replaced with more specific types.

so i'm tending towards favoring more liberal use `# type: ignore` in preference to `cast`.

However, I think we may start to encounter more and more issues with the untyped _lib.pyx imports. mypy has good understanding of isinstance, but not of the `is_*` functions.

have spent some time looking at stubbing and overloading, no joy yet. so we may need to add casts after every `is_*` call.

