def _replace_emails(self, matchobj):
        found = matchobj.group(0)
        new, original = self.mapped_emails.get(found.lower(), (None, None))
        if new is not None:
            if found != original:
                raise ValueError(
                    "Case mismatch for %s, %s" % (found, original))
            return new
        new = self._random_email()
        self.mapped_emails[found.lower()] = (new, found)
        return new