code: def missing_any(da, freq, **kwds):
      r
      c = da.notnull().resample(time=freq).sum(dim='time')
  
      if '-' in freq:
          pfreq, anchor = freq.split('-')
      else:
          pfreq = freq
  
      if pfreq.endswith('S'):
          start_time = c.indexes['time']
          end_time = start_time.shift(1, freq=freq)
      else:
          end_time = c.indexes['time']
          start_time = end_time.shift(-1, freq=freq)
  
      n = (end_time - start_time).days
      nda = xr.DataArray(n.values, coords={'time': c.time}, dims='time')
      return c != nda
docs: r"""Return a boolean DataArray indicating whether there are missing days in the resampled array.
  
      Parameters
      ----------
      da : DataArray
        Input array at daily frequency.
      freq : str
        Resampling frequency.
  
      Returns
      -------
      out : DataArray
        A boolean array set to True if any month or year has missing values.