code: def _get_pydantic_json_dict(pydantic_obj: BaseModel) -> dict:
      try:
          return pydantic_obj.model_dump()  # type: ignore
      except:
          # if using pydantic v1
          return pydantic_obj.dict()
  
imports: import sys, os, platform, time, copy, re, asyncio, inspect
  import threading, ast
  import shutil, random, traceback, requests
  from datetime import datetime, timedelta, timezone
  from typing import Optional, List
  import secrets, subprocess
  import hashlib, uuid
  import warnings
  import importlib
  import random
  import litellm
  from litellm.proxy.utils import PrismaClient, DBClient, get_instance_fn, ProxyLogging, _cache_user_row, send_email
  from litellm.proxy.secret_managers.google_kms import load_google_kms
  import pydantic
  from litellm.proxy._types import *
  from litellm.caching import DualCache
  from litellm.proxy.health_check import perform_health_check
  from litellm._logging import verbose_router_logger, verbose_proxy_logger
  from fastapi import FastAPI, Request, HTTPException, status, Depends, BackgroundTasks, Header, Response
  from fastapi.routing import APIRouter
  from fastapi.security import OAuth2PasswordBearer
  from fastapi.encoders import jsonable_encoder
  from fastapi.responses import StreamingResponse, FileResponse, ORJSONResponse, JSONResponse
  from fastapi.middleware.cors import CORSMiddleware
  from fastapi.security.api_key import APIKeyHeader
  import json
  import logging
  from typing import Union
  from typing import Dict
label_desc: Use image node_id 4 for calling a global function with example usage: _get_pydantic_json_dict(pydantic_obj) and returns: pydantic_obj, pydantic_obj