functools_24.py: do not rely on internal python module implementation details

Or at least check if the needed attributes exists before tryting to get them.

Signed-off-by: Cleber Rosa <crosa@redhat.com>