export colormap to GMT's CPT format

Hi,

I have a `LinearSegmentedColormap` which I would like to export to GMT's CPT format. However, I couldn't find a way to get the RBG values of the `N` color slices of the colormap, which I need in order to create the CPT file.

Any help is greatly appreciated.

Cheers,
Andreas.