Given a config field name as a string, how to get the value?

Suppose I have a config and the name of a field, such as “isr.datasetType”. What is the best way to get the value of the field? Using getattr doesn’t work if the item is a subtask:

>>> namespace.config.isr.datasetType
>>> getattr(namespace.config, "isr.datasetType")
*** AttributeError: 'ProcessCcdConfig' object has no attribute 'isr.datasetType'

The technique I am using is to walk through one item at a time, but I am wondering if there is a more direct method. Here is an example with no error handling:

    keyList = name.split(".")
    value = config
    for key in keyList:
        value = getattr(item, key)

Naively shouldn’t that looping be part of the class itself so that getattr keeps on going down the hierarchy?

I suspect that would be difficult for the Config class because the attributes in question are Field instances, but the class has special code to permit reading and changing values as if they were values, not instances of complex classes. However, that is merely a guess; I don’t really know how the code works.