This code should work on both the MH-Z19B and MH-Z19C CO2 sensors, although it was only tested with the MH-Z19C. There are no dependencies. I've never written similar code, hence PRs are particularly welcome. The implementation is based on UedaTakeyuki/mh-z20 which didn't work for the Pico out of the box.
Copy this module on your Pico, import it to your program, instantiate the sensor class and read the CO2 value. For example:
from mh_z19 import MH_Z19
sensor = MH_Z19(Pin(UART_TX_PIN), Pin(UART_RX_PIN))
print(sensor.read_co2())
MIT, see the LICENSE file.