def get_brand(data): for brand in brands: if re.search(r'(^| )%s( |$)' % brand, data, re.I): return brand return 'NIHUYA'