def encode2unicode(text, charmap):
    '''
    charmap : dictionary which has both encode as key, unicode as value
    '''
    if isinstance(text, (list, tuple)):
        unitxt = ''
        for line in text:
            for key,val in charmap.items():
                if key in line:
                    line = line.replace(key, val)
                # end of if key in text:
            unitxt += line
        # end of for line in text:
        return unitxt
    elif isinstance(text, str):
        for key,val in charmap.items():
            if text in key:
                text = text.replace(key, val)
        return text
    raise Exception("Unexpected input kind. Must be string or list or tuple")
dataset/ETHPy150Open Ezhil-Language-Foundation/open-tamil/tamil/txt2unicode/encode2unicode.py/encode2unicode/swapped operands of `in`