<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace(text):
 """Replace both the hex and decimal versions of symbols in an XML string"""

  for hex, value in UNICODE_DICTIONARY.items():
    num = int(hex[3:-1], 16)
    #uni = unichr(num)
    decimal = '&#' + str(num) + ';'
    for key in [ hex, decimal ]: #uni
      text = text.replace(key, value)
  return text