def item_brand(item, attributes_dict, attribute_values_dict):
 brand = None
 brand_attribute_pk = attributes_dict.get(u'brand')
 publisher_attribute_pk = attributes_dict.get(u'publisher')
 if brand_attribute_pk:
  brand = item.get_attribute(brand_attribute_pk)
  if (brand is None):
   brand = item.product.get_attribute(brand_attribute_pk)
 if ((brand is None) and (publisher_attribute_pk is not None)):
  brand = item.get_attribute(publisher_attribute_pk)
  if (brand is None):
   brand = item.product.get_attribute(publisher_attribute_pk)
 if (brand is not None):
  brand_name = attribute_values_dict.get(brand)
  if (brand_name is not None):
   return brand_name
 return brand

def item_brand ( item , attributes_dict , attribute_values_dict ) : brand = None brand_attribute_pk = attributes_dict . get ( u'brand' ) publisher_attribute_pk = attributes_dict . get ( u'publisher' ) if brand_attribute_pk : brand = item . get_attribute ( brand_attribute_pk ) if ( brand is None ) : brand = item . product . get_attribute ( brand_attribute_pk ) if ( ( brand is None ) and ( publisher_attribute_pk is not None ) ) : brand = item . get_attribute ( publisher_attribute_pk ) if ( brand is None ) : brand = item . product . get_attribute ( publisher_attribute_pk ) if ( brand is not None ) : brand_name = attribute_values_dict . get ( brand ) if ( brand_name is not None ) : return brand_name return brand
this field is required .