code: def extension_add_method(self, object, name, function):
          
  
          if object == 'display':
              if hasattr(self, name):
                  raise AssertionError('attempting to replace display method: %s' % name)
  
              self.display_extension_methods[name] = function
  
          else:
              class_list = (object, ) + _resource_hierarchy.get(object, ())
              for class_name in class_list:
                  cls = _resource_baseclasses[class_name]
                  if hasattr(cls, name):
                      raise AssertionError('attempting to replace %s method: %s' % (class_name, name))
  
                  method = create_unbound_method(function, cls)
  
                  # Maybe should check extension overrides too
                  try:
                      self.class_extension_dicts[class_name][name] = method
                  except KeyError:
                      self.class_extension_dicts[class_name] = { name: method }
docs: extension_add_method(object, name, function)
  
          Add an X extension module method.  OBJECT is the type of
          object to add the function to, a string from this list:
  
              display
              resource
              drawable
              window
              pixmap
              fontable
              font
              gc
              colormap
              cursor
  
          NAME is the name of the method, a string.  FUNCTION is a
          normal function whose first argument is a 'self'.