def METHOD_NAME(ttf):
    try:
        result = {}
        # This is loosely based on: https://github.com/fonttools/fonttools/blob/main/Snippets/layout-features.py
        for tag in ('GSUB', 'GPOS'):
            if not tag in ttf: continue
            table = ttf[tag].table
            if not tag in result:
                result[tag] = {}
            if not table.ScriptList or not table.FeatureList: continue
            featureRecords = table.FeatureList.FeatureRecord
            for script in table.ScriptList.ScriptRecord:
                if not script.Script: continue
                if not script.ScriptTag in result[tag]:
                    result[tag][script.ScriptTag] = {}
                languages = list(script.Script.LangSysRecord)
                if script.Script.DefaultLangSys:
                    defaultlangsys = otTables.LangSysRecord()
                    defaultlangsys.LangSysTag = "default"
                    defaultlangsys.LangSys = script.Script.DefaultLangSys
                    languages.insert(0, defaultlangsys)
                for langsys in languages:
                    if not langsys.LangSys: continue
                    if not langsys.LangSysTag in result[tag][script.ScriptTag]:
                        result[tag][script.ScriptTag][langsys.LangSysTag] = []
                    features = [featureRecords[index] for index in langsys.LangSys.FeatureIndex]
                    if langsys.LangSys.ReqFeatureIndex != 0xFFFF:
                        record = featureRecords[langsys.LangSys.ReqFeatureIndex]
                        requiredfeature = otTables.FeatureRecord()
                        requiredfeature.FeatureTag = 'required(%s)' % record.FeatureTag
                        requiredfeature.Feature = record.Feature
                        features.insert(0, requiredfeature)
                    for feature in features:
                        result[tag][script.ScriptTag][langsys.LangSysTag].append(feature.FeatureTag)
        return result
    except Exception:
        logging.exception('Error reading OpenType feature data')
    return None