def METHOD_NAME(self, frame, reader_class, out_type):
    if out_type == self.Type.BUFFER:
        return self._av_frame_to_png_bytes(frame) if reader_class is VideoReader else frame
    elif out_type == self.Type.PIL:
        return frame.to_image() if reader_class is VideoReader else Image.open(frame)
    elif out_type == self.Type.NUMPY_ARRAY:
        if reader_class is VideoReader:
            image = frame.to_ndarray(format='bgr24')
        else:
            image = np.array(Image.open(frame))
            if len(image.shape) == 3 and image.shape[2] in {3, 4}:
                image[:, :, :3] = image[:, :, 2::-1] # RGB to BGR
        return image
    else:
        raise RuntimeError('unsupported output type')