def expand(self, template): """Return the string obtained by doing backslash substitution and resolving group references on template.""" import sre return sre._expand(self.re, self, template)