def _decode_uni_string(self, input_str, def_name):
    encoded_strings = re.findall('=\\?.*?\\?=', input_str, re.I)
    if (not encoded_strings):
        return input_str
    try:
        decoded_strings = [decode_header(x)[0] for x in encoded_strings]
        decoded_strings = [{'value': x[0], 'encoding': x[1]} for x in decoded_strings]
    except Exception as e:
        (error_code, error_msg) = self._get_error_message_from_exception(e)
        self._base_connector.debug_print('Decoding: {0}. Error code: {1}. Error message: {2}'.format(encoded_strings, error_code, error_msg))
        return def_name
    decoded_strings = dict(enumerate(decoded_strings))
    new_str = ''
    new_str_create_count = 0
    for (i, encoded_string) in enumerate(encoded_strings):
        decoded_string = decoded_strings.get(i)
        if (not decoded_string):
            continue
        value = decoded_string.get('value')
        encoding = decoded_string.get('encoding')
        if ((not encoding) or (not value)):
            continue
        try:
            if (encoding != 'utf-8'):
                value = str(value, encoding)
        except Exception:
            pass
        try:
            if value:
                new_str += UnicodeDammit(value).unicode_markup
                new_str_create_count += 1
        except Exception:
            pass
    if (new_str and (new_str_create_count == len(encoded_strings))):
        self._base_connector.debug_print('Creating a new string entirely from the encoded_strings and assiging into input_str')
        input_str = new_str
    return input_str
def _decode_uni_string(self, input_str, def_name):
    encoded_strings = re.findall('=\\?.*?\\?=', input_str, re.I)
    if (not encoded_strings):
        return input_str
    try:
        decoded_strings = [decode_header(x)[0] for x in encoded_strings]
        decoded_strings = [{'value': x[0], 'encoding': x[1]} for x in decoded_strings]
    except Exception as e:
        (error_code, error_msg) = self._get_error_message_from_exception(e)
        self._base_connector.debug_print('Decoding: {0}. Error code: {1}. Error message: {2}'.format(encoded_strings, error_code, error_msg))
        return def_name
    decoded_strings = dict(enumerate(decoded_strings))
    new_str = 
    new_str_create_count = 0
    for (i, encoded_string) in enumerate(encoded_strings):
        decoded_string = decoded_strings.get(i)
        if (not decoded_string):
            continue
        value = decoded_string.get('value')
        encoding = decoded_string.get('encoding')
        if ((not encoding) or (not value)):
            continue
        try:
            if (encoding != 'utf-8'):
                value = str(value, encoding)
        except Exception:
            pass
        try:
            if value:
                new_str += UnicodeDammit(value).unicode_markup
                new_str_create_count += 1
        except Exception:
            pass
    if (new_str and (new_str_create_count == len(encoded_strings))):
        self._base_connector.debug_print('Creating a new string entirely from the encoded_strings and assiging into input_str')
        input_str = new_str
    return input_str