'Replace CSTRING(\'\'\'xyz\'\'\') by a C compatible string'

def wrap_c_strings(self, impl):

    if ('CSTRING(' not in impl):
        return impl
    def split_string(matchobj):
        content = matchobj.group(1).replace('"', '"')
        return ''.join(((('"%s\\n"\n' % line) if ((not line.endswith('\\')) or line.endswith('\\\\')) else ('"%s"\n' % line[:(-1)])) for line in content.splitlines()))
    impl = re.sub('CSTRING\\(\\s*"""([^"]*(?:"[^"]+)*)"""\\s*\\)', split_string, impl)
    assert ('CSTRING(' not in impl)
    return impl
