'The path to a module/class/function definition.'

def _path(self):

    def to_reverse():
        name = self._name
        if (name.api_type == 'module'):
            try:
                name = list(name.infer())[0].name
            except IndexError:
                pass
        if (name.api_type == 'module'):
            (module_context,) = name.infer()
            for n in reversed(module_context.py__name__().split('.')):
                (yield n)
        else:
            (yield name.string_name)
        parent_context = name.parent_context
        while (parent_context is not None):
            try:
                method = parent_context.py__name__
            except AttributeError:
                try:
                    (yield parent_context.name.string_name)
                except AttributeError:
                    pass
            else:
                for name in reversed(method().split('.')):
                    (yield name)
            parent_context = parent_context.parent_context
    return reversed(list(to_reverse()))
