Fixed python string substitution in error messages for trace and transpose. Added tests for invalid axis offsets for trace on the c++ side.