from typing import Any
import dill
import hashlib


def pickle_and_hash(obj: Any) -> str:
    """
    Uses ``dill`` to pickle an object and returns the SHA-512 hash of the returned bytes.

    Args:
        obj (``object``): the object to pickle and hash
    
    Returns:
        ``str``: the hex digest of the SHA-512 hash of the pickled object
    """
    s = dill.dumps(obj)
    return hashlib.sha512(s).hexdigest()