9.2.1 Semantics Description Utilities

The requirements for the creation of a <semanticDescription> resource include base64 encoding the 'dsp' attribute. There are many libraries that do this operation and for this example python was used.

import base64

def smdEncode(description):
    msgAscii = description.encode('ascii')
    b64 = base64.b64encode(msgAscii)
    descriptionb64 = b64.decode('ascii')
    return descriptionb64

def smdDecode(message):
    b64d = message.encode('ascii')
    msgdAscii = base64.b64decode(b64d)
    return msgdAscii.decode('ascii')