def get_display_label(choices, status):
 for (value, label) in choices:
  if (value == (status or '').lower()):
   display_label = label
   break
 else:
  display_label = status
 return display_label

def get_display_label ( choices , status ) : for ( value , label ) in choices : if ( value == ( status or '' ) . lower ( ) ) : display_label = label break else : display_label = status return display_label
this method is used in places where a resources status or admin state labels need to assigned before they are sent to the view template .