code: def update_team(
      *,
      session: Session = Depends(get_session),
      team_id: int,
      team: TeamUpdate,
  ):
      db_team = session.get(Team, team_id)
      if not db_team:
          raise HTTPException(status_code=404, detail="Team not found")
      team_data = team.model_dump(exclude_unset=True)
      for key, value in team_data.items():
          setattr(db_team, key, value)
      session.add(db_team)
      session.commit()
      session.refresh(db_team)
      return db_team
  
imports: from typing import Optional
  from fastapi import Depends, FastAPI, HTTPException, Query
  from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
label_desc: Use image node_id 12 for calling a global function with example usage: update_team() and returns: db_team