code: def select_time(da, **indexer):
      
      if not indexer:
          selected = da
      else:
          key, val = indexer.popitem()
          time_att = getattr(da.time.dt, key)
          selected = da.sel(time=time_att.isin(val)).dropna(dim='time')
  
      return selected
docs: Select entries according to a time period.
  
      Parameters
      ----------
      da : xarray.DataArray
        Input data.
      **indexer : {dim: indexer, }, optional
        Time attribute and values over which to subset the array. For example, use season='DJF' to select winter values,
        month=1 to select January, or month=[6,7,8] to select summer months. If not indexer is given, all values are
        considered.
  
      Returns
      -------
      xr.DataArray
        Selected input values.