def indent_lines(code: str, level: int, spaces: int = 4):
    """
    indentation helper function. Add spaces in front of every line of code
    :param code: string, code to be indented
    :param level: indentation level
    :param spaces: # of spaces per level
    :return: indented string
    """
    width = level * spaces
    lines = code.split('\n')

    return '\n'.join([line.rjust(width + len(line), ' ') for line in lines])