def METHOD_NAME(self, node):
    d = {}
    class_name = node.__class__.__name__
    for field, value in ast.iter_fields(node):
        if field == "ops": # For Compare()
            # We only represent one comparison operator
            assert len(value) == 1
            d[field] = self.visit(value[0])
        elif isinstance(value, list):
            new_list = []
            for item in value:
                if isinstance(item, ast.AST):
                    new_list.append(self.visit(item))
                else:
                    if type(item) == str:
                        new_list.append(item)
                    elif item is None:
                        new_list.append(self.visit(python_ast.ConstantNone()))
            d[field] = new_list
        elif field in ["vararg", "kwarg"]:
            if value is None:
                d[field] = []
            else:
                d[field] = [self.visit(value)]
        elif isinstance(value, ast.AST):
            d[field] = self.visit(value)
        elif isinstance(value, (str, int)):
            d[field] = value
        elif value is None:
            d[field] = value
        else:
            print("Node type:", class_name)
            print("Value type:", type(value))
            raise Exception("Unsupported value type")
    new_ast = getattr(python_ast, class_name)
    new_node = new_ast(**d)
    if hasattr(node, "col_offset"):
        new_node.first = linecol_to_pos(node.lineno, node.col_offset+1, newlines)
        new_node.last = linecol_to_pos(node.end_lineno, node.end_col_offset, newlines)
    else:
        new_node.first = 1
        new_node.last = 1
    return new_node