Hi guys I am trying to run this code, however I keep getting the return outside of function error, can anybody help with this?

```
import random
money = 100
num = random.randint(1, 10)
#Write your game of chance functions here
def coin_flip(guess, bet):
coin_flip = random.choice(['Heads', 'Tails'])
#randomly generates heads or tails choice.
if coin_flip == 'Heads':
return "Congratulations, you guessed correctly! You have won " + str(money*2) +"!"
else:
return "Unfortunately you have lost " + str(money/2) + " better luck next time"
#Call your game of chance functions here
print(coin_flip('Tails', 30))
And this syntax error keeps coming up:
File "script.py", line 9
return "Congratulations, you guessed correctly! You have won " + str(money*2) +"!"
^
SyntaxError: 'return' outside function
Thanks in advance
```