ESM openfold_utils type hints
# What does this PR do?

This PR generally adds type hints for the files located at `src/transformers/models/esm/openfold_utils/`.

0. add function/method parameter type hints where missing; add type info on collections
1. export `dict_multimap`, `flatten_final_dims`, `permute_final_dims` in `__init__.py` since these functions are currently duplicated in [src/transformers/models/esm/modeling_esmfold.py](https://github.com/huggingface/transformers/blob/2e17db8a8626baeea7efd6f2700be863f026699c/src/transformers/models/esm/modeling_esmfold.py#L218-L238); exporting these from `openfold_utils` should allow us to remove these duplicates
2. refactor `type(x) is y` to use the builtin `isinstance(x, y)`
3. refactor to avoid reassignment to the same variable with a different type (this is frowned upon by type checkers) by using multiple variables / combining expressions to avoid reassignment
4. add `assert` statements to to narrow types
5. add a `FIXME` statement at an apparent bug in [`protein.py`](https://github.com/huggingface/transformers/pull/20544/files#diff-b7388405b8a9b1877a3eeb6b6941091f68e321717beec3abb7727cd3114115bfR84) in which string mutation is attempted
6. various minor refactors

<!-- Remove if not applicable -->

Related: https://github.com/huggingface/transformers/issues/16059

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

## Who can review?

@Rocketknight1 

_The documentation is not available anymore as the PR was closed or merged._<|||||>Wow, this is really comprehensive! All of your edits seem good, and thanks for catching those duplicate functions!

The code is failing some of our code style checks, but I believe I can fix that for you, hang on!<|||||>I think the other issues are just old issues with our repo - they'll be fixed if you pull from upstream on your fork's `main` branch in the GitHub UI and then rebase your branch onto that, followed by a force push<|||||>@ringohoffman Looks good to me now! Are you okay with me merging it?<|||||>> @ringohoffman Looks good to me now! Are you okay with me merging it?

I'm good if you are!