def _reverse_lookup(dictionary, value):
 value_index = (-1)
 for (idx, dict_value) in enumerate(dictionary.values()):
  if (type(dict_value) == list):
   if (value in dict_value):
    value_index = idx
    break
  elif (value == dict_value):
   value_index = idx
   break
 return dictionary.keys()[value_index]

def _reverse_lookup ( dictionary , value ) : value_index = ( - 1 ) for ( idx , dict_value ) in enumerate ( dictionary . values ( ) ) : if ( type ( dict_value ) == list ) : if ( value in dict_value ) : value_index = idx break elif ( value == dict_value ) : value_index = idx break return dictionary . keys ( ) [ value_index ]
lookup the key in a dictionary by its value .