def __get__(self, obj, objtype):
if obj not in self.instancemethods:<EOL><INDENT>self.objclass = obj.__class__<EOL>if obj not in Encapsulate.encapsulations:<EOL><INDENT>Encapsulate.encapsulations[obj] = {self.func_name: []}<EOL><DEDENT>Encapsulate.encapsulations[obj][self.func_name].append(self)<EOL>for enc in Encapsulate.encapsulations[obj][self.func_name]:<EOL><INDENT>call_order = []<EOL>for ii, cls in enumerate(objtype.__mro__):<EOL><INDENT>func = cls.__dict__.get(self.func_name, None)<EOL>if isinstance(func, Encapsulate):<EOL><INDENT>func = func._func<EOL><DEDENT>call_order.append(func)<EOL><DEDENT>try:<EOL><INDENT>idx = call_order.index(enc._func)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if idx > <NUM_LIT:0> and any(call_order[:idx]):<EOL><INDENT>enc.overridden = True<EOL><DEDENT><DEDENT><DEDENT>self.instancemethods[obj] = partial(self.__call__, obj)<EOL><DEDENT>return self.instancemethods[obj]<EOL>
Support instance methods.