from typing import Dict
import binascii
import base64
import json


def _decode(encoded: bytes) -> Dict:
    """
    Decode an dictionary (document) encoded as a base64-encoded string.

    :param encoded: the base64-encoded string
    :return: the dictionary (document) object
    """
    dec_ascii: bytes = encoded
    dec_ascii_bytes: bytes = binascii.a2b_base64(dec_ascii)
    dec_bytes: bytes = base64.b64decode(dec_ascii_bytes)
    return json.loads(dec_bytes.decode('utf-8'))