code: def unicode2encode(text, charmap):
      '''
      charmap : dictionary which has both encode as key, unicode as value
      '''
      if isinstance(text, (list, tuple)):
          unitxt = ''
          for line in text:
              for val,key in charmap.items():
                  if key in line:
                      line = line.replace(key, val)
                  # end of if val in text:
              unitxt += line
          # end of for line in text:
          return unitxt
      elif isinstance(text, str):
          for val,key in charmap.items():
              if key in text:
                  text = text.replace(key, val)
          return texf unicode2encode(text, charmap):
      '''
      charmap : dictionary which has both encode as key, unicode as value
      '''
      if isinstance(text, (list, tuple)):
          unitxt = ''
          for line in text:
              for val,key in charmap.items():
                  if key in line:
                      line = line.replace(key, val)
                  # end of if val in text:
              unitxt += line
          # end of for line in text:
          return unitxt
      elif isinstance(text, str):
          for val,key in charmap.items():
              if key in text:
                  text = text.replace(key, val)
          return text
docs: charmap : dictionary which has both encode as key, unicode as value