def _ancestors_to_call(klass_node, method='__init__'):
 to_call = {}
 for base_node in klass_node.ancestors(recurs=False):
  try:
   to_call[base_node] = next(base_node.igetattr(method))
  except astroid.InferenceError:
   continue
 return to_call

def _ancestors_to_call ( klass_node , method = '__init__' ) : to_call = { } for base_node in klass_node . ancestors ( recurs = False ) : try : to_call [ base_node ] = next ( base_node . igetattr ( method ) ) except astroid . InferenceError : continue return to_call
return a dictionary where keys are the list of base classes providing the queried method .