Melatonin for My Dog with Cancer and Other Ailments

Melatonin is most well-known as a supplement to help us sleep. How could this help our dogs? And, more importantly, how could it help a dog with cancer?