change hasattr(summarizer, '__call__') to callable(summarizer