docs: def validate_field_list(fields, allow_fmt_specs=False, name_filter=None):
      """ Make sure the fields in the given list exist.
  
          @param fields: List of fields (comma-/space-separated if a string).
          @type fields: list or str
          @return: validated field names.
          @rtype: list
      """
      formats = [i[4:] for i in globals() if i.startswith("fmt_")]
  
      try:
          fields = [i.strip() for i in fields.replace(',', ' ').split()]
      except AttributeError:
          # Not a string, expecting an iterable
          pass
  
      if name_filter:
          fields = [name_filter(name) for name in fields]
  
      for name in fields:
          if allow_fmt_specs and '.' in name:
              fullname = name
              name, fmtspecs = name.split('.', 1)
              for fmtspec in fmtspecs.split('.'):
                  if fmtspec not in formats and fmtspec != "raw":
                      raise error.UserError("Unknown format specification %r in %r" % (fmtspec, fullname))
  
          if name not in engine.FieldDefinition.FIELDS and not engine.TorrentProxy.add_manifold_attribute(name):
              raise error.UserError("Unknown field name %r" % (name,))
  
      return fields