code: def _AddPropertiesForExtensions(descriptor, cls):
    
    extension_dict = descriptor.extensions_by_name
    for extension_name, extension_field in extension_dict.items():
      constant_name = extension_name.upper() + "_FIELD_NUMBER"
      setattr(cls, constant_name, extension_field.number)
  
    # TODO(amauryfa): Migrate all users of these attributes to functions like
    #   pool.FindExtensionByNumber(descriptor).
    if descriptor.file is not None:
      # TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
      pool = descriptor.file.pool
      cls._extensions_by_number = pool._extensions_by_number[descriptor]
      cls._extensions_by_name = pool._extensions_by_name[descriptor]
docs: Adds properties for all fields in this protocol message type.