def assemble_due_date(assignment: dict):
    """
    Returns a timestamp string from the dueDate and dueTime dict attributes, if present.
    Returns None if there is no dueDate attribute.
    """
    try:
        date = assignment['dueDate']
    except KeyError:
        return None

    due_date = "%04d-%02d-%02d" % (date['year'], date['month'], date['day'])
    try:
        time = assignment['dueTime']
        due_date += " %02d:%02d:%02d.%03dZ" % (time['hours'], time['minutes'], time['seconds'], time['nanos'])
    except KeyError:
        # If no dueTime specified, default to the end of the day on the dueDate
        due_date += " 23:59:59.999Z"

    return due_date