I find it easier to read when the mixed code is like this:

```python
map_func = """
function () {
  emit(this._id.org.toLowerCase()+this._id.course.toLowerCase(), {target: this._id});
}

class Command(...):
    def handler(....):
        results = mstore.collection.map_reduce(map_func, ...)

""


```