docs: def set_required(field, render_kw=None, force=False):
      """
      Returns *render_kw* with *required* set if the field is required.
  
      Sets the *required* key if the `required` flag is set for the field (this
      is mostly the case if it is set by validators). The `required` attribute
      is used by browsers to indicate a required field.
  
      ..note::
  
          This won't change keys already present unless *force* is used.
  
      """
      if render_kw is None:
          render_kw = {}
      if 'required' in render_kw and not force:
          return render_kw
      if field.flags.required:
          render_kw['required'] = True
      return render_kw