I'd actually like this to be within an anonymous function: something like this:
``` javascript
!function(mpld3,  undefined){
  {{ extra_js }}
  mpld3.draw_figure("{{ figid }}", {{ figure_json }});
}(mpld3);
```
(pretty sure this is OK, though I'd want to double-check that it works).