def cms_to_token(cms_text):
 start_delim = '-----BEGIN CMS-----'
 end_delim = '-----END CMS-----'
 signed_text = cms_text
 signed_text = signed_text.replace('/', '-')
 signed_text = signed_text.replace(start_delim, '')
 signed_text = signed_text.replace(end_delim, '')
 signed_text = signed_text.replace('\n', '')
 return signed_text

def cms_to_token ( cms_text ) : start_delim = '-----BEGIN CMS-----' end_delim = '-----END CMS-----' signed_text = cms_text signed_text = signed_text . replace ( '/' , '-' ) signed_text = signed_text . replace ( start_delim , '' ) signed_text = signed_text . replace ( end_delim , '' ) signed_text = signed_text . replace ( '\n' , '' ) return signed_text
convert a cms-signed token in pem format to a custom url-safe format .