def com_google_fonts_check_metadata_canonical_filename(font_metadata,
                                                       canonical_filename,
                                                       is_variable_font):
  """METADATA.pb: Filename is set canonically?"""

  if is_variable_font:
    valid_varfont_suffixes = [
      ("Roman-VF", "Regular"),
      ("Italic-VF", "Italic"),
    ]
    for valid_suffix, style in valid_varfont_suffixes:
      if style in canonical_filename:
        canonical_filename = valid_suffix.join(canonical_filename.split(style))

  if canonical_filename != font_metadata.filename:
    yield FAIL, ("METADATA.pb: filename field (\"{}\")"
                 " does not match "
                 "canonical name \"{}\".".format(font_metadata.filename,
                                                 canonical_filename))
  else:
    yield PASS, "Filename in METADATA.pb is set canonically."