Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_name_by_name(search_name, production_name=False):
"""
Use this if you don't know what exact type your name is. E.g. when
the names in your source are mixes friendly names and production names.
Returns None if GlyphsData.xml doesn't contain search_name.
"""
entry = (None, None)
glyph = GlyphData.by_name.get(search_name, None) \
or GlyphData.by_prodname.get(search_name, None)
if glyph is not None:
entry = (glyph.name, glyph.production_name)
return entry[1] if production_name else entry[0]