Log out and Sleep mode

I wonder if it is possible to log out and then set the Mac to sleep mode using Apple Script.
I then want to assign this script to an F-Key, so that it takes me only one keystroke to logout out my computer and turn it to sleep
Is this possible? OS X 10.1.3.
Best regards, Stefan