def METHOD_NAME(key):
    # Remove menu entry labels
    # In our data model, they conflict with the actual configuration
    # they are associated to
    # i.e. Nucleo_144.menu.pnum.NUCLEO_F207ZG would be both
    # a string ("Nucleo F207ZG")
    # and a dict (.build.variant_h=..., .upload.maximum_size=...)
    if key[0] == "menu":
        # menu.xserial=U(S)ART support
        return True
    if len(key) == 4 and key[1] == "menu":
        # Nucleo_144.menu.pnum.NUCLEO_F207ZG=Nucleo F207ZG
        # Midatronics.menu.upload_method.MassStorage=Mass Storage
        return True
    # keep bootloader flags that impact the build
    if len(key) >= 6 and key[1] == "menu" and key[2] == "upload_method":
        if key[3] != "build":
            return False
        return True
    return False