def find_a_b(x1: float, x2: float, y1: float, y2: float) -> tuple[float, float]:
    """Compute the values of 'a' and 'b' for a scaled and shifted tanh function.

    Given two points (x1, y1) and (x2, y2), this function calculates the coefficients 'a' and 'b'
    for a tanh function of the form y = 0.5 * (tanh(a * (x - b)) + 1) that passes through these points.

    The derivation is as follows:

    1. Start with the equation of the tanh function:
       y = 0.5 * (tanh(a * (x - b)) + 1)

    2. Rearrange the equation to isolate tanh:
       tanh(a * (x - b)) = 2*y - 1

    3. Take the inverse tanh (or artanh) on both sides to solve for 'a' and 'b':
       a * (x - b) = artanh(2*y - 1)

    4. Plug in the points (x1, y1) and (x2, y2) to get two equations.
       Using these, we can solve for 'a' and 'b' as:
       a = (artanh(2*y2 - 1) - artanh(2*y1 - 1)) / (x2 - x1)
       b = x1 - (artanh(2*y1 - 1) / a)

    Parameters
    ----------
    x1
        x-coordinate of the first point.
    x2
        x-coordinate of the second point.
    y1
        y-coordinate of the first point (should be between 0 and 1).
    y2
        y-coordinate of the second point (should be between 0 and 1).

    Returns
    -------
    a
        Coefficient 'a' for the tanh function.
    b
        Coefficient 'b' for the tanh function.

    Notes
    -----
    The values of y1 and y2 should lie between 0 and 1, inclusive.

    """
    a = (math.atanh(2 * y2 - 1) - math.atanh(2 * y1 - 1)) / (x2 - x1)
    b = x1 - (math.atanh(2 * y1 - 1) / a)
    return a, b
Compute the values of 'a' and 'b' for a scaled and shifted tanh function.

    Given two points (x1, y1) and (x2, y2), this function calculates the coefficients 'a' and 'b'
    for a tanh function of the form y = 0.5 * (tanh(a * (x - b)) + 1) that passes through these points.

    The derivation is as follows:

    1. Start with the equation of the tanh function:
       y = 0.5 * (tanh(a * (x - b)) + 1)

    2. Rearrange the equation to isolate tanh:
       tanh(a * (x - b)) = 2*y - 1

    3. Take the inverse tanh (or artanh) on both sides to solve for 'a' and 'b':
       a * (x - b) = artanh(2*y - 1)

    4. Plug in the points (x1, y1) and (x2, y2) to get two equations.
       Using these, we can solve for 'a' and 'b' as:
       a = (artanh(2*y2 - 1) - artanh(2*y1 - 1)) / (x2 - x1)
       b = x1 - (artanh(2*y1 - 1) / a)

    Parameters
    ----------
    x1
        x-coordinate of the first point.
    x2
        x-coordinate of the second point.
    y1
        y-coordinate of the first point (should be between 0 and 1).
    y2
        y-coordinate of the second point (should be between 0 and 1).

    Returns
    -------
    a
        Coefficient 'a' for the tanh function.
    b
        Coefficient 'b' for the tanh function.

    Notes
    -----
    The values of y1 and y2 should lie between 0 and 1, inclusive.

    
custom_components/adaptive_lighting/color_and_brightness.py