@classmethod<EOL><INDENT>def by_id(cls, _id, engine_or_session):<DEDENT>
ses, auto_close = ensure_session(engine_or_session)<EOL>obj = ses.query(cls).get(_id)<EOL>if auto_close:<EOL><INDENT>ses.close()<EOL><DEDENT>return obj<EOL>
Get one object by primary_key value.

:type engine_or_session: Union[Engine, Session]