code: def add_bands(data, bands):
      
      # Add R, G and B bands, remove L band
      if 'L' in data['bands'].data and 'R' in bands.data:
          lum = data.sel(bands='L')
          new_data = xr.concat((lum, lum, lum), dim='bands')
          new_data['bands'] = ['R', 'G', 'B']
          data = new_data
      # Add alpha band
      if 'A' not in data['bands'].data and 'A' in bands.data:
          new_data = [data.sel(bands=band) for band in data['bands'].data]
          # Create alpha band based on a copy of the first "real" band
          alpha = new_data[0].copy()
          alpha.data = da.ones((data.sizes['y'],
                                data.sizes['x']),
                               chunks=new_data[0].chunks)
          # Rename band to indicate it's alpha
          alpha['bands'] = 'A'
          new_data.append(alpha)
          new_data = xr.concat(new_data, dim='bands')
          data = new_data
  
      return data
docs: Add bands so that they match *bands*