code: def get_pk(obj):
      
      if inspect.isclass(obj):
          pk_list = sqlalchemy.inspect(obj).primary_key
      else:
          pk_list = obj.__mapper__.primary_key
      return pk_list
docs: Return primary key name by model class or instance.
  
      :Parameters:
          - `obj`: SQLAlchemy model instance or class.
  
      :Examples:
  
      >>> from sqlalchemy import Column, Integer
      >>> from sqlalchemy.ext.declarative import declarative_base
      >>> Base = declarative_base()
      >>> class User(Base):
      ...     __tablename__ = 'users'
      ...     id = Column(Integer, primary_key=True)
      >>> get_pk(User())
      (Column('id', Integer(), table=<users>, primary_key=True, nullable=False),)
      >>> get_pk(User)
      (Column('id', Integer(), table=<users>, primary_key=True, nullable=False),)