python: how to get attribute of attribute of an object with getattr?,"from functools import reduce