docstr: Edit an existing predictor's code
docstr_tok: ["Edit","an","existing","predictor","'s","code"]
code: def edit_code(self, name: str, code: str):
      """Edit an existing predictor's code"""
      if self.config.get("cloud", False):
          raise Exception("Code editing prohibited on cloud")
  
      predictor_record = get_model_record(
          name=name, ml_handler_name="lightwood"
      )
      assert predictor_record is not None
  
      lightwood.predictor_from_code(code)
      predictor_record.code = code
      db.session.commit()
  
      json_storage = get_json_storage(resource_id=predictor_record.id)
      json_storage.delete("json_ai")
  
imports: import copy
  import json
  import sys
  from datetime import datetime
  from functools import lru_cache
  from typing import Dict, Optional
  import lightwood
  import numpy
  import pandas
  from type_infer.dtype import dtype
  import mindsdb.interfaces.storage.db
  import mindsdb.utilities.profiler
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.interfaces.model.functions import get_model_record
  from mindsdb.interfaces.storage.json import get_json_storage
  from mindsdb.utilities.functions import cast_row_types
  from .functions import run_finetune, run_learn
label_desc: Use image node_id 8 for calling the LightwoodHandler obj's underlying member method code with example usage: obj.edit_code(name, code) without return types