import hashlib


def sha1(text):
    """
    Calculate the hexadecimal SHA1 digest of a string.

    :param text: The string of which to calculate the SHA1 digest.
    :returns: A string of 40 hexadecimal characters.
    """
    return hashlib.sha1(str(text).encode()).hexdigest()