How about doing this with:

```
encoding="us-ascii"
# code that detects the encoding if it exists, here
return cElementTree.tostring(root, encoding=encoding)
```