docs: def _init_fields(self):
          """Update fields based on schema options."""
          if self.opts.fields:
              available_field_names = self.set_class(self.opts.fields)
          else:
              available_field_names = self.set_class(self.declared_fields.keys())
              if self.opts.additional:
                  available_field_names |= self.set_class(self.opts.additional)
  
          invalid_fields = self.set_class()
  
          if self.only is not None:
              # Return only fields specified in only option
              field_names = self.set_class(self.only)
  
              invalid_fields |= field_names - available_field_names
          else:
              field_names = available_field_names
  
          # If "exclude" option or param is specified, remove those fields.
          exclude_field_names = set(self.opts.exclude) | set(self.exclude)
          if exclude_field_names:
              # Note that this isn't available_field_names, since we want to
              # apply "only" for the actual calculation.
              field_names = field_names - exclude_field_names
  
              invalid_fields |= exclude_field_names - available_field_names
  
          if invalid_fields:
              message = 'Invalid fields for {}: {}.'.format(self, invalid_fields)
              raise ValueError(message)
  
          fields_dict = self.dict_class()
          for field_name in field_names:
              field_obj = self.declared_fields.get(field_name, ma_fields.Inferred())
              self._bind_field(field_name, field_obj)
              fields_dict[field_name] = field_obj
  
          dump_data_keys = [
              obj.data_key or name for name, obj in iteritems(fields_dict) if not obj.load_only
          ]
          if len(dump_data_keys) != len(set(dump_data_keys)):
              data_keys_duplicates = {x for x in dump_data_keys if dump_data_keys.count(x) > 1}
              raise ValueError(
                  'The data_key argument for one or more fields collides '
                  "with another field's name or data_key argument. "
                  'Check the following field names and '
                  'data_key arguments: {}'.format(list(data_keys_duplicates)),
              )
  
          load_attributes = [
              obj.attribute or name for name, obj in iteritems(fields_dict) if not obj.dump_only
          ]
          if len(load_attributes) != len(set(load_attributes)):
              attributes_duplicates = {x for x in load_attributes if load_attributes.count(x) > 1}
              raise ValueError(
                  'The attribute argument for one or more fields collides '
                  "with another field's name or attribute argument. "
                  'Check the following field names and '
                  'attribute arguments: {}'.format(list(attributes_duplicates)),
              )
  
          return fields_dict