code: def write_ast(patched_ast_node):
      
      result = []
      for child in patched_ast_node.sorted_children:
          if isinstance(child, ast.AST):
              result.append(write_ast(child))
          else:
              result.append(child)
      return ''.join(result)
docs: Extract source form a patched AST node with `sorted_children` field
  
      If the node is patched with sorted_children turned off you can use
      `node_region` function for obtaining code using module source code.