def deadband(val, dead=0.2, scale=1):
    """Return the deadband value for the controller Axis.

    Args:
        val (float): Raw controller value -1 to 1.
        dead (float)[0.2]: Deadband value
        scale (int) [1]: 100, 10, 1 indicates the range -100 to 100 ...
    """
    val = float(val)
    dead = abs(float(dead))

    # Check if the deadband is the same as the scale
    if dead == scale:
        dead = scale * 0.99

    if val >= dead:
        val -= dead
    elif val <= -dead:
        val += dead
    else:
        val = 0

    val = (val/(scale-dead)) * scale
    return val