import NDIR
import time

sensor = NDIR.Sensor(0x4D)
sensor.begin()

while True:
    sensor.measure()
    print("CO2 Concentration: " + str(sensor.ppm) + "ppm")
    time.sleep(1)

import NDIR
import time

sensor = NDIR.Sensor(0x4D)

if sensor.begin() == False:
    print("Adaptor initialization FAILED!")
    exit()

while True:
    if sensor.measure():
        print("CO2 Concentration: " + str(sensor.ppm) + "ppm")
    else:
        print("Sensor communication ERROR.")

    time.sleep(1)

Make use of the return value of begin() and measure()
Make use of the return value of begin() and measure()