code: def _AddClearExtensionMethod(cls):
    
    def ClearExtension(self, extension_handle):
      _VerifyExtensionHandle(self, extension_handle)
  
      # Similar to ClearField(), above.
      if extension_handle in self._fields:
        del self._fields[extension_handle]
      self._Modified()
    cls.ClearExtension = ClearExtension
docs: Helper for _AddMessageMethods().