def application_to_app_label(application):
 if isinstance(application, string_types):
  app_label = application.split('.')[(-1)]
 else:
  app_label = application.__name__.split('.')[(-1)]
 return app_label

def application_to_app_label ( application ) : if isinstance ( application , string_types ) : app_label = application . split ( '.' ) [ ( - 1 ) ] else : app_label = application . __name__ . split ( '.' ) [ ( - 1 ) ] return app_label
works out the app label from either the app label .