If you open the tiffs as numpys you can apply any condition you want to them with numpy where.
ds = gdal.Open(A)
band = ds.GetRasterBand(1)
arrA = band.ReadAsArray()
ds = gdal.Open(B)
band = ds.GetRasterBand(1)
arrB = band.ReadAsArray()
arrC = np.where((arrA != <yourwhitevalue>), arrA, arrB)
[cols, rows] = array.shape
driver = gdal.GetDriverByName("GTiff")
outdata = driver.Create('{}.tif'.format('C'), rows, cols, 1,gdal.GDT_UInt32)
outdata.SetGeoTransform(ds.GetGeoTransform()) ##sets same geotransform as input
outdata.SetProjection(ds.GetProjection()) ##sets same projection as input
outdata.GetRasterBand(1).WriteArray(array)
outdata.GetRasterBand(1).SetNoDataValue(0) ##if you want these values transparent
outdata.FlushCache() ##saves to disk!!
outdata = None
band = None
ds = None
Description The gdalwarp utility is an image mosaicing, reprojection and warping utility.