def cell_brain(self):
        text = self.code
        pre_code = """
from calysto.simulation import *
robot = get_robot()
def brain():
"""
        post_code = """robot.brain = brain"""
        new_code = ("    ".join(line + "\n" for line in text.split("\n")))
        self.code = pre_code + new_code + post_code
%%brain - run a cell as brain control code
dataset/ETHPy150Open Calysto/metakernel/metakernel/magics/brain_magic.py/BrainMagic.cell_brain