def check_pattern(pattern, raise_error=True) -> bool:
    """Checks if an individual pattern is valid.

    Parameters
    ----------
    pattern : BasePattern
        A pattern instance to be checked.

    raise_error : bool (default True)
        Signal to raise an error if the pattern is not valid.

    Returns
    -------
    True if the pattern is valid; False otherwise.

    Raises
    ------
    ValueError
        If raise_error was signaled.
    """
    if (
        callable(getattr(pattern, "partial_fit_transform", None))
        and callable(getattr(pattern, "partial_fit", None))
        and callable(getattr(pattern, "transform", None))
    ):
        return True

    elif raise_error:
        raise ValueError(
            "All perturbation patterns must implement the 'transform',"
            + " 'partial_fit' and 'partial_fit_transform' methods."
        )

    else:
        return False