def ListFeatures(font, table, name_fn):
  """List features for specified font. Table assumed structured like GPS/GSUB.

  Args:
    font: a TTFont.
    table: name of table.
    name_fn: function to resolve lookup type => name.
  Returns:
    List of 3-tuples of ('GPOS', tag, name) of the features in the font.
  """
  results = []
  if table not in font:
    return results

  tab = font[table].table
  if not tab or not tab.LookupList or not tab.LookupList.Lookup:
    return results
  lookups = tab.LookupList.Lookup

  for feat in tab.FeatureList.FeatureRecord:
    tag = feat.FeatureTag
    for idx in feat.Feature.LookupListIndex:
      lookup_name = name_fn(lookups[idx].LookupType)
      results.append((table, tag, lookup_name))

  return results