def cleanup_code(self, content):
"""Automatically removes code blocks from the code."""
# remove ```py\n
if content.startswith('```') and content.endswith('```'):
return '\n'.join(content.split('\n')[1:-1])
# remove `foo`
for p in self.settings["REPL_PREFIX"]:
if content.startswith(p):
if p == '`':
return content.strip('` \n')
content = content[len(p):]
return content.strip(' \n')
```