def _make_getter(self, segment, class_):

        # Attempt to resolve properties and simple functions by
        # accessing the class attribute directly.
        obj = getattr(class_, segment, None)
        if obj is not None:
            if hasattr(obj, '__call__'):
                return obj.__call__

            if hasattr(obj, '__get__'):
                return lambda target, x=obj.__get__: x(target, class_)

        # Check for much better hidden descriptor.
        obj = class_.__dict__.get(segment)
        if obj is not None and hasattr(obj, '__get__'):
            return lambda target, x=obj.__get__: x(target, class_)

        # Check for item access (for a dictionary).
        if hasattr(class_, '__getitem__'):
            def getter(target):
                try:
                    return target[segment]

                except __HOLE__:
                    return None

            return getter

        # Check for attribute access.
        if hasattr(class_, '__dict__'):
            return lambda target: target.__dict__.get(segment)

        raise RuntimeError(
            'unable to resolve attribute access for %r on %r' % (
                segment, class_))
dataset/ETHPy150Open armet/python-armet/armet/attributes/attribute.py/Attribute._make_getter