def METHOD_NAME(new_name, species, dex):
    if new_name in LEGACY_MAP:
        old_name = LEGACY_MAP[new_name]
        if old_name in dex:
            return old_name
    old_name = utils.trim(new_name)
    if not old_name in dex and '-' in old_name:
        # Try - -> _?
        name = old_name.replace('-', '_')
        if(name in dex):
            old_name = name
    if not old_name in dex and '-gmax' in old_name:
        # Try gmax?
        old_name = old_name.replace('-gmax', '_gigantamax')
    if not old_name in dex and '-mega' in old_name:
        # Try mega?
        old_name = old_name.replace('-mega', '_mega')
    if not old_name in dex:
        name = old_name.replace('-', '')
        if(name in dex):
            old_name = name
    if old_name in dex:
        return old_name
    return Non