Remove bad tet elements from a Mesh Python command

I have searched in the Cubit documentation for ways to delete bad elements from a free mesh but no luck. Do you know if there is a python command to do such a thing?
So basically, I have an STL that I mesh and sometimes the mesh produces undesirable flat elements with zero volume, which I wish to remove. I was wondering if there is a python command to use to select certain elements from the generated mesh and delete them before exporting the mesh to Abaqus input.

Hi Amir,

Does this work for you in your python script? I create a group containing elements with a shape metric with a maximum of 0.1. Then I delete the tetrahdra in that group.

cubit.cmd("group 'bad_tets' equals quality tet all quality shape  high .1")
cubit.cmd("delete tet in bad_tets")

Thanks,
Karl