Solution 1:

A couple things. Looking at your python file, you seem to be trying to use curly braces {} to denote blocks of code. Python works by using indentation. so

void foo(){
    puts("foo");
}

becomes

def foo():
    print("foo")

Also, you can't run your python script just like that, you need to either add a hashbang (probably #!/usr/bin/python) to the start of the file and using ./recovery.py, or simply running python recovery.py from your terminal.