def decode_product_name(msg): manufacturer = None prodname = None for f in msg['fields']: if profile.field_name(f[0], f[1]) == 'MANUFACTURER': manufacturer = f[3] if profile.field_name(f[0], f[1]) == 'PRODUCT' and manufacturer is not None: f[3] = profile.product_name(manufacturer, f[3])