import typing


def _get_exceptions(specification: dict) -> typing.Dict[str, dict]:
    """
    Assemble a mapping of client exceptions raised by the methods.

    These are extracted from the specified service specification where the values are
    the shape mappings for those exceptions as specified in the service specification.

    :param specification:
        Botocore service specification from which to extract exception
        information.
    :return:
        Dictionary of exception names and their corresponding shapes
        set on the client.exceptions object.
    """
    errors = {
        error["shape"]
        for item in specification["operations"].values()
        for error in (item.get("errors") or [])
    }
    return {e: specification["shapes"][e] for e in errors}