def _keypath_component_handler(component):
    match = _keypath_index_subscript_pattern.match(component)
    if match and match.group('index'):
        return int(match.group('index'))
    else:
        return component
>>> _keypath_component_handler('str')
dataset/ETHPy150Open sodastsai/taskr/taskr/contrib/collections.py/_keypath_component_handler