def dict_key_for_value(_dict, value):
    return _dict.keys()[_dict.values().index(value)]
This function is used to get key by value in a dictionary
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/libs/serializers/attachment_serializer.py/dict_key_for_value