import hashlib
from datetime import datetime


def get_unique_job_id() -> str:
    """
    Returns a 64 hex-character (lowercase) string.
        e.g., 'e2cddf55dc410ec584d647157388e96f22bf7b60d900e79afd1c56e27aa0e417'

    :return string:
    """
    job_id = hashlib.sha256(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f').encode('utf-8')).hexdigest()
    # We no longer use TxJob so can't check it for duplicates
    #   (but could theoretically check the preconvert bucket since job_id.zip is saved there).
    #while TxJob.get(job_id):
        #job_id = hashlib.sha256(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f').encode('utf-8')).hexdigest()
    return job_id