[core][py] small code cleaning