This is called type hinting, and is only used to help make it easier for the programmer to understand the return and input types of a program, as well as allow for external linting and static analysis programs to work on Python. Here is the official RFC explaining why it exists.
Type hints are not actually used by Python anyway (because Python is dynamically typed - the types are determined at runtime, not at compile time when the source is actually parsed) and can be safely omitted.
Functions conforming to your Version 2 are perfectly fine in every case.
Python 3 has inbuilt support for type hints with the typing
module, while Python 2.7 requires the third-party mypy
module.