How to learn how to create custom functions and learn Deluge

How to learn how to create custom functions and learn Deluge

What is the easiest way for me to learn how to write custom functions and learn the Deluge programming language? Where can I find samples so I can understand how to write the deluge code properly?