code: def update_hero(
      *,
      session: Session = Depends(get_session),
      hero_id: int,
      hero: HeroUpdate,
  ):
      db_hero = session.get(Hero, hero_id)
      if not db_hero:
          raise HTTPException(status_code=404, detail="Hero not found")
      hero_data = hero.model_dump(exclude_unset=True)
      for key, value in hero_data.items():
          setattr(db_hero, key, value)
      session.add(db_hero)
      session.commit()
      session.refresh(db_hero)
      return db_hero
  
imports: from typing import List, Optional
  from fastapi import Depends, FastAPI, HTTPException, Query
  from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
label_desc: Use image node_id 7 for calling a global function with example usage: update_hero() and returns: db_hero