import pprint
import hashlib


def generate_hash(data_in):
    """
    Generate a hash from the data_in that can be used to uniquely identify
    equivalent data_in.

    Args:
        data_in (any):
            The data from which a hash is to be generated. This can be of any
            type that can be pretty printed.
    Returns:
        str:
            A hexadecimal string which is a hash hexdigest of the data as a
            string.
    """
    bytestring = pprint.pformat(data_in).encode("utf-8")
    return hashlib.sha256(bytestring).hexdigest()