How to obtain get_last_id in the classical journals

How do I get the last volume id with the classical journals like “get_last_id(‘volume’)” in python API.
In the following journal, in stead of “#{id1=1}”, I would prefer to obtain last id.

reset
create sphere radius 100
#{id1=1}
volume 1 copy move z 200 nomesh
#{id2=2}
volume {#id1} rename ‘sph1’
volume {#id2} rename ‘sph2’

The APREPRO function Id(“type”) will do what you want. From the documentation,

Returns the ID of the entity most recently created with the specified type. Acceptable types include: “body”, “volume”, “surface”, “curve”, “vertex”, “group”, “node”, “edge”, “quad”, “face”, “tri”, “hex”, “tet”, or “pyramid”.

In your example, do something like

reset
create sphere radius 100
volume {Id("volume")} name 'sph1'
volume sph1 copy move z 200
volume {Id("volume")} rename 'sph2'

Thank you. It helps me a lot.