code: def sign(self, data):
          
          try:
              jsonstr = json.dumps(data, separators=(',', ':'))
  
          except TypeError as e:
              raise DataSignError(e.args[0])
  
          else:
              signature = self._create_signature(jsonstr)
              return self._b64encode(jsonstr + '.' + signature)
docs: Create url-safe signed token.
  
          :param data: Data to sign
          :type data: object