def _should_really_index(self, instance):
if self._should_index_is_method:<EOL><INDENT>is_method = inspect.ismethod(self.should_index)<EOL>try:<EOL><INDENT>count_args = len(inspect.signature(self.should_index).parameters)<EOL><DEDENT>except AttributeError:<EOL><INDENT>count_args = len(inspect.getargspec(self.should_index).args)<EOL><DEDENT>if is_method or count_args is <NUM_LIT:1>:<EOL><INDENT>return self.should_index(instance)<EOL><DEDENT>else:<EOL><INDENT>return self.should_index()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>attr_type = type(self.should_index)<EOL>if attr_type is DeferredAttribute:<EOL><INDENT>attr_value = self.should_index.__get__(instance, None)<EOL><DEDENT>elif attr_type is str:<EOL><INDENT>attr_value = getattr(instance, self.should_index)<EOL><DEDENT>elif attr_type is property:<EOL><INDENT>attr_value = self.should_index.__get__(instance)<EOL><DEDENT>else:<EOL><INDENT>raise AlgoliaIndexError('<STR_LIT>'.format(<EOL>self.should_index))<EOL><DEDENT>if type(attr_value) is not bool:<EOL><INDENT>raise AlgoliaIndexError("<STR_LIT>" % (<EOL>instance.__class__.__name__, self.should_index))<EOL><DEDENT>return attr_value<EOL><DEDENT>
Return True if according to should_index the object should be indexed.