def inventory(
        self, freq: str, required: Union[datetime, tuple, bool] = True
    ) -> "Stations":
        """
        Filter weather stations by inventory data
        """

        # Create temporal instance
        temp = copy(self)

        if required is True:
            # Make sure data exists at all
            temp._data = temp._data[~pd.isna(temp._data[f"{freq}_start"])]

        elif isinstance(required, tuple):
            # Make sure data exists across period
            temp._data = temp._data[
                (~pd.isna(temp._data[f"{freq}_start"]))
                & (temp._data[freq + "_start"] <= required[0])
                & (
                    temp._data[freq + "_end"] + timedelta(seconds=temp.max_age)
                    >= required[1]
                )
            ]

        else:
            # Make sure data exists on a certain day
            temp._data = temp._data[
                (~pd.isna(temp._data[f"{freq}_start"]))
                & (temp._data[freq + "_start"] <= required)
                & (
                    temp._data[freq + "_end"] + timedelta(seconds=temp.max_age)
                    >= required
                )
            ]

        return temp

        Filter weather stations by inventory data
        
meteostat/interface/stations.py