def METHOD_NAME(self, source):
    offset = 0
    tokens = ['# -*- coding: %s -*-' % self.encoding]
    start, end = self.delimiters
    escaped = (re.escape(start), re.escape(end))
    regex = re.compile('%s(.*?)%s' % escaped, re.DOTALL)
    for i, part in enumerate(regex.split(source)):
        part = part.replace('\\'.join(start), start)
        part = part.replace('\\'.join(end), end)
        if i % 2 == 0:
            if not part: continue
            part = part.replace('\\', '\\\\').replace('"', '\\"')
            part = '\t' * offset + 'write("""%s""")' % part
        else:
            part = part.rstrip()
            if not part: continue
            part_stripped = part.lstrip()
            if part_stripped.startswith(':'):
                if not offset:
                    raise SyntaxError('no block statement to terminate: ${%s}$' % part)
                offset -= 1
                part = part_stripped[1:]
                if not part.endswith(':'): continue
            elif self.autowrite.match(part_stripped):
                part = 'write(%s)' % part_stripped
            lines = part.splitlines()
            margin = min(len(l) - len(l.lstrip()) for l in lines if l.strip())
            part = '\n'.join('\t' * offset + l[margin:] for l in lines)
            if part.endswith(':'):
                offset += 1
        tokens.append(part)
    if offset:
        raise SyntaxError('%i block statement(s) not terminated' % offset)
    return compile('\n'.join(tokens), self.file or '<string>', 'exec')