from osgeo import gdal
from osgeo.gdalconst import GA_Update
filename = 'somefile.tif'
nodata = 0
# open the file for editing
ras = gdal.Open(filename, GA_Update)
# loop through the image bands
for i in range(1, ras.RasterCount + 1):
# set the nodata value of the band
ras.GetRasterBand(i).SetNoDataValue(nodata)
# unlink the file object and save the results
ras = None
gdal_translate -of GTiff -a_nodata 0 {src scene path} {dst scene path}