In Python 3.9 and later versions, you can use the generic syntax for all standard collections currently available in the typing
module, which makes your code cleaner and more readable.
In Python 3.10 and later versions, you can use the |
operator for the union syntax, which further simplifies your code.