### Using quotes inside sageplot environment in SageTeX

Here's the question: how do I get the following to work in SageTeX? The quotes always lead to an error.

```
\sageplot{plot(cos(x),(x,0,pi),label='$\cos(x)$')}
```

~~\sageplot{plot(cos(x),(x,0,pi),label='$\cos(x)$')}
~~Double quotes, escaping them, ... nothing seems to work. Thanks!

(See also this tex.SX.com question if you want to answer it in both places for more visibility.)