Swap characters from a script to transliteration and vice versa. 
        Optionally sanitize string by using preprocess function.

        :param preprocess:
        :param string:
        :return:

def convert(self, string, preprocess = None):
        """
        Swap characters from a script to transliteration and vice versa. 
        Optionally sanitize string by using preprocess function.

        :param preprocess:
        :param string:
        :return:
        """
        string = unicode(preprocess(string) if preprocess else string, encoding="utf-8")
        if self.regex:
            return self.regex.sub(lambda x: self.substitutes[x.group()], string).encode('utf-8')
        else:
            return string