code: def run(self, mod):
          
          if not mod.body:
              # Nothing to do.
              return
          # Insert some special imports at the top of the module but after any
          # docstrings and __future__ imports.
          aliases = [ast.alias(py.builtin.builtins.__name__, "@py_builtins"),
                     ast.alias("dessert.rewrite", "@dessert_ar")]
          expect_docstring = True
          pos = 0
          lineno = 0
          for item in mod.body:
              if (expect_docstring and isinstance(item, ast.Expr) and
                      isinstance(item.value, ast.Str)):
                  doc = item.value.s
                  if "PYTEST_DONT_REWRITE" in doc:
                      # The module has disabled assertion rewriting.
                      return
                  lineno += len(doc) - 1
                  expect_docstring = False
              elif (not isinstance(item, ast.ImportFrom) or item.level > 0 or
                    item.module != "__future__"):
                  lineno = item.lineno
                  break
              pos += 1
          imports = [ast.Import([alias], lineno=lineno, col_offset=0)
                     for alias in aliases]
          mod.body[pos:pos] = imports
          # Collect asserts.
          nodes = [mod]
          while nodes:
              node = nodes.pop()
              for name, field in ast.iter_fields(node):
                  if isinstance(field, list):
                      new = []
                      for i, child in enumerate(field):
                          if isinstance(child, ast.Assert):
                              # Transform assert.
                              new.extend(self.visit(child))
                          else:
                              new.append(child)
                              if isinstance(child, ast.AST):
                                  nodes.append(child)
                      setattr(node, name, new)
                  elif (isinstance(field, ast.AST) and
                        # Don't recurse into expressions as they can't contain
                        # asserts.
                        not isinstance(field, ast.expr)):
                      nodes.append(field)
docs: Find all assert statements in *mod* and rewrite them.