<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def com_daltonmaag_check_unnecessary_fields(ufo_font):
 """Check that no unnecessary fields are present in the UFO fontinfo. ufo2ft will generate these. openTypeOS2UnicodeRanges and openTypeOS2CodePageRanges are exempted because it is useful to toggle a range when not _all_ the glyphs in that region are present. year is deprecated since UFO v2. """

  unnecessary_fields = []

  for field in [
      "openTypeNameUniqueID", "openTypeNameVersion", "postscriptUniqueID",
      "year"
  ]:
    if ufo_font.info.__dict__.get("_" + field) is not None:
      unnecessary_fields.append(field)

  if unnecessary_fields:
    yield WARN, f"Unnecessary field(s) present: {unnecessary_fields}"
  else:
    yield PASS, "Unnecessary fields omitted."