def unescape_entities(value):
 safe_characters = {'&amp;': '&'}
 if isinstance(value, dict):
  return {key: unescape_entities(value) for (key, value) in value.iteritems()}
 if is_iterable_but_not_string(value):
  return [unescape_entities(each) for each in value]
 if isinstance(value, basestring):
  for (escape_sequence, character) in safe_characters.items():
   value = value.replace(escape_sequence, character)
  return value
 return value

def unescape_entities ( value ) : safe_characters = { '&amp;' : '&' } if isinstance ( value , dict ) : return { key : unescape_entities ( value ) for ( key , value ) in value . iteritems ( ) } if is_iterable_but_not_string ( value ) : return [ unescape_entities ( each ) for each in value ] if isinstance ( value , basestring ) : for ( escape_sequence , character ) in safe_characters . items ( ) : value = value . replace ( escape_sequence , character ) return value return value
convert html-encoded data to literal characters .