<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_images(cfg):
 """Helper function for loading a set of color images, depth images, and IR camera intrinsics. The config dictionary must have these keys: - prestored_data -- If 1, use the virtual sensor, else use a real sensor. - prestored_data_dir -- A path to the prestored data dir for a virtual sensor. - sensor/frame -- The frame of reference for the sensor. - sensor/device_num -- The device number for the real Kinect. - sensor/pipeline_mode -- The mode for the real Kinect's packet pipeline. - num_images -- The number of images to generate. Parameters cfg : :obj:`dict` A config dictionary. Returns ------- :obj:`tuple` of :obj:`list` of :obj:`ColorImage`, :obj:`list` of :obj:`DepthImage`, :obj:`CameraIntrinsics` A set of ColorImages and DepthImages, and the Kinect's CameraIntrinsics for its IR sensor. """

    if 'prestored_data' in cfg.keys() and cfg['prestored_data'] == 1:
        sensor = VirtualKinect2Sensor(path_to_images=cfg['prestored_data_dir'], frame=cfg['sensor']['frame'])
    else:
        sensor = Kinect2Sensor(device_num=cfg['sensor']['device_num'], frame=cfg['sensor']['frame'],
                               packet_pipeline_mode=cfg['sensor']['pipeline_mode'])
    sensor.start()
    ir_intrinsics = sensor.ir_intrinsics

    # get raw images
    colors = []
    depths = []

    for _ in range(cfg['num_images']):
        color, depth, _ = sensor.frames()
        colors.append(color)
        depths.append(depth)

    sensor.stop()

    return colors, depths, ir_intrinsics