def _handle_unicode_for_input_str(self, input_str): """ This method returns the encoded|original string based on the Python version. :param input_str: Input string to be processed :return: encoded input_str """ try: if input_str: input_str = UnicodeDammit(input_str).unicode_markup.encode( 'utf-8') input_str = input_str.decode('utf-8') except: self.debug_print("Error occurred while encoding input string") return input_str