code: def std_blocksum(data, block_sizes, mask=None):
      
  
      data = np.ma.asanyarray(data)
  
      if mask is not None and mask is not np.ma.nomask:
          mask = np.asanyarray(mask)
          if data.shape != mask.shape:
              raise ValueError('data and mask must have the same shape.')
          data.mask |= mask
  
      stds = []
      block_sizes = np.atleast_1d(block_sizes)
      for block_size in block_sizes:
          mesh_values = _mesh_values(data, block_size)
          block_sums = np.sum(mesh_values, axis=1)
          stds.append(np.std(block_sums))
  
      return np.array(stds)
docs: Calculate the standard deviation of block-summed data values at
      sizes of ``block_sizes``.
  
      Values from incomplete blocks, either because of the image edges or
      masked pixels, are not included.
  
      Parameters
      ----------
      data : array-like
          The 2D array to block sum.
  
      block_sizes : int, array-like of int
          An array of integer (square) block sizes.
  
      mask : array-like (bool), optional
          A boolean mask, with the same shape as ``data``, where a `True`
          value indicates the corresponding element of ``data`` is masked.
          Blocks that contain *any* masked data are excluded from
          calculations.
  
      Returns
      -------
      result : `~numpy.ndarray`
          An array of the standard deviations of the block-summed array
          for the input ``block_sizes``.