code: def serializable_insert(record: Base, try_count: int = 100):
      """Do serializeble insert. If fail - repeat it {try_count} times.
  
      Args:
          record (Base): sqlalchey record to insert
          try_count (int): count of tryes to insert record
      """
      commited = False
      while not commited:
          session.connection(
              execution_options={"isolation_level": "SERIALIZABLE"}
          )
          if engine.name == "postgresql":
              session.execute(
                  text("LOCK TABLE PREDICTOR IN EXCLUSIVE MODE")
              )
          session.add(record)
          try:
              session.commit()
          except OperationalError:
              # catch 'SerializationFailure' (it should be in str(e), but it may depend on engine)
              session.rollback()
              try_count += -1
              if try_count == 0:
                  raise
          else:
              commited = True
  
imports: import datetime
  import json
  import os
  from typing import Dict, List
  import numpy
  from sqlalchemy import JSON, Boolean, Column, DateTime, Index, Integer, String, Table, UniqueConstraint, create_engine, text, types
  from sqlalchemy.exc import OperationalError
  from sqlalchemy.orm import Mapped, declarative_base, relationship, scoped_session, sessionmaker
  from sqlalchemy.sql.schema import ForeignKey
  from mindsdb.utilities.json_encoder import CustomJSONEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: serializable_insert(record, try_count) without return types