'Decodes an opaque string to a dictionary.
:type token: str
:param token: A token string given by the botocore pagination
interface.
:rtype: dict
:returns: A dictionary containing pagination information,
particularly the service pagination token(s) but also other boto
metadata.'

def decode(self, token):

    json_string = base64.b64decode(token.encode('utf-8')).decode('utf-8')
    decoded_token = json.loads(json_string)
    encoded_keys = decoded_token.pop('boto_encoded_keys', None)
    if (encoded_keys is None):
        return decoded_token
    else:
        return self._decode(decoded_token, encoded_keys)
