import hashlib


def checksum(record_payload):
    """
    Returns a md5 checksum calculated from the provided DOI record payload.

    Parameters
    ----------
    record_payload : str
        Text contents of a DOI record to generate the checksum for.

    Returns
    -------
    hex_digest : str
        The hex digest of the md5 checksum.

    """
    md5 = hashlib.md5()
    md5.update(record_payload.encode())
    return md5.hexdigest()