#NEWLINE# def get_attributes_display_map( variant , attributes ) : #NEWLINE# #INDENT# display = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for attribute in attributes : #NEWLINE# #INDENT# value = variant . get_attribute ( attribute . pk ) #NEWLINE# if value : #NEWLINE# #INDENT# choices = { a . pk : a for a in attribute . values . all ( ) } #NEWLINE# attr = choices . get ( value ) #NEWLINE# if attr : #NEWLINE# #INDENT# display [ attribute . pk ] = attr #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# display [ attribute . pk ] = value #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return display