def _indent(code, by=1, tabsize=4, newline=False):
    """Indents every nonempty line of the given code."""
    return "".join(
        (" " * (tabsize * by) if line else "") + line
        for line in code.splitlines(True)
    ) + ("\n" if newline else "")