def get_obj_property_value(obj, field):
    """
    Given an object and a field which may have nested properties
    return value of nested property
    >>> class demo: pass
    >>> demo.ls = []
    >>> get_obj_property_value(demo, 'ls.__class__')
    <<< list
    """

    _attr_list = field.split('.')

    if len(_attr_list) > 1:
        tmp_obj = getattr(obj, _attr_list[0])

        return get_obj_property_value(tmp_obj, '.'.join(_attr_list[1:]))

    return getattr(obj, field)
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/libs/serializers/fields/hyperlinked_multi_related_field.py/get_obj_property_value/original