
    Given a binary maintenance status code for a transit vehicle where each bit represents a completed (1) or pending (0) maintenance check, develop a function that identifies and marks the highest-priority pending maintenance task as complete by setting the leftmost unset bit to 1. The function should efficiently process the status code to update only the next pending maintenance task while preserving the status of all other maintenance checks.
    

    
def set_left_most_unset_bit(n):
    """
    Given a binary maintenance status code for a transit vehicle where each bit represents a completed (1) or pending (0) maintenance check, develop a function that identifies and marks the highest-priority pending maintenance task as complete by setting the leftmost unset bit to 1. The function should efficiently process the status code to update only the next pending maintenance task while preserving the status of all other maintenance checks.
    

    """
def set_left_most_unset_bit(n):
    """
    Given a binary maintenance status code for a transit vehicle where each bit represents a completed (1) or pending (0) maintenance check, develop a function that identifies and marks the highest-priority pending maintenance task as complete by setting the leftmost unset bit to 1. The function should efficiently process the status code to update only the next pending maintenance task while preserving the status of all other maintenance checks.
    

    """
    if not n & n + 1:
        return n
    (pos, temp, count) = (0, n, 0)
    while temp:
        if not temp & 1:
            pos = count
        count += 1
        temp >>= 1
    return n | 1 << pos