Change these to just 
`vendor_name = r['vendor_name'] or r['vendor_hex']`