Is Melatonin bad to take when pregnant??

Katy
I'm 21 week pregnant and not getting very good sleep lately has anyone taken this or told by a doctor that it was ok?