Reaction of n-halo-amides and -imides with diazomethane