Fix ModelHubMixin coders (#2291)
* update HubMixinTest with union and optional custom type
* enable ModelHubMixin to handle union and optional custom type
* add docstring for _is_optional_type helper function
* Refactor helper functions and add independent unit tests. Refactor decode_arg
* Restrict UnionType check to python3.10 and above. Minor style updates.
* Only branch to pipe tests when version >= python3.10
* Change pipe operator tests to str + eval
---------
Co-authored-by: Lucain <lucain@huggingface.co>