code: def _delete_unwanted_caracters(self, chain):
          
          try:
              chain = chain.decode('utf8', 'replace')
          except UnicodeEncodeError:
              # If it is still encoded correctly, ignore...
              pass
          except AttributeError:
              # Python 3 will raise an exception because the line is still unicode
              pass
          for char in self.illegal_macro_output_chars:
              chain = chain.replace(char, '')
          return chain
docs: Remove not wanted char from chain
          unwanted char are illegal_macro_output_chars attribute
  
          :param chain: chain to remove char from
          :type chain: str
          :return: chain cleaned
          :rtype: str