def _prepare_boundaries(
        lower_bound_name: str,
        upper_bound_name: str,
        lower_bound: Optional[Union[Sequence[float], float]] = None,
        upper_bound: Optional[Union[Sequence[float], float]] = None,
    ) -> tuple[list[Optional[float]], list[Optional[float]]]:
        """
        Process the boundaries argument and perform some sanity checks

        Parameters
        ----------
        lower_bound_name
            Name of the lower bound
        upper_bound_name
            Name of the upper bound
        lower_bound
            (Sequence of) numerical bound below which a value is regarded as anomaly.
            If a sequence, must match the dimensionality of the series
            this detector is applied to.
        upper_bound
            (Sequence of) numerical bound above which a value is regarded as anomaly.
            If a sequence, must match the dimensionality of the series
            this detector is applied to.

        Returns
        -------
        lower_bound
            Lower bounds, as a list of values (at least one not None value)
        upper_bound
            Upper bounds, as a list of values (at least one not None value)
        """
        if lower_bound is None and upper_bound is None:
            raise_log(
                ValueError(
                    f"`{lower_bound_name} and `{upper_bound_name}` cannot both be `None`."
                ),
                logger=logger,
            )

        def _prep_boundaries(boundaries) -> list[Optional[float]]:
            """Convert boundaries to List"""
            return (
                boundaries.tolist()
                if isinstance(boundaries, np.ndarray)
                else (
                    [boundaries] if not isinstance(boundaries, Sequence) else boundaries
                )
            )

        # convert to list
        lower_bound = _prep_boundaries(lower_bound)
        upper_bound = _prep_boundaries(upper_bound)

        if all([lo is None for lo in lower_bound]) and all([
            hi is None for hi in upper_bound
        ]):
            raise_log(
                ValueError("All provided upper and lower bounds values are None."),
                logger=logger,
            )

        # match the lengths of the boundaries
        lower_bound = (
            lower_bound * len(upper_bound) if len(lower_bound) == 1 else lower_bound
        )
        upper_bound = (
            upper_bound * len(lower_bound) if len(upper_bound) == 1 else upper_bound
        )

        if not len(lower_bound) == len(upper_bound):
            raise_log(
                ValueError(
                    f"Parameters `{lower_bound_name}` and `{upper_bound_name}` "
                    f"must be of the same length `n`, found "
                    f"`{lower_bound_name}`: n={len(lower_bound)} and "
                    f"`{upper_bound_name}`: n={len(upper_bound)}."
                ),
                logger=logger,
            )
        if not all([
            lb is None or ub is None or lb <= ub
            for (lb, ub) in zip(lower_bound, upper_bound)
        ]):
            raise_log(
                ValueError(
                    f"All values in `{lower_bound_name}` must be lower or equal"
                    f"to their corresponding value in `{upper_bound_name}`."
                ),
                logger=logger,
            )
        return lower_bound, upper_bound

        Process the boundaries argument and perform some sanity checks

        Parameters
        ----------
        lower_bound_name
            Name of the lower bound
        upper_bound_name
            Name of the upper bound
        lower_bound
            (Sequence of) numerical bound below which a value is regarded as anomaly.
            If a sequence, must match the dimensionality of the series
            this detector is applied to.
        upper_bound
            (Sequence of) numerical bound above which a value is regarded as anomaly.
            If a sequence, must match the dimensionality of the series
            this detector is applied to.

        Returns
        -------
        lower_bound
            Lower bounds, as a list of values (at least one not None value)
        upper_bound
            Upper bounds, as a list of values (at least one not None value)
        
darts/ad/detectors/detectors.py