<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert(string, sanitize=False):
 """ Swap characters from script to transliterated version and vice versa. Optionally sanitize string by using preprocess function. :param sanitize: :param string: :return: """

    return r.convert(string, (preprocess if sanitize else False))