def split_attenuation(att):
    """
    Split the attenuation value into two parts, one that can be realized by
    setting the hardware attenuator (the RZ6 attenuator can be set to 0, 20, 40
    or 60 dB) and the second that must be realized by scaling the waveform.

    Returns (hw_attenuation, sw_attenuation)
    ----------------------------------------
    hw_attenuation : float
        hardware attenuation setting
    sw_attenuation : float
        remaining attenuation that must be realized by scaling the waveform
    """
    hw_step = min(int(att / 20.0), 3)
    hw_att = hw_step * 20.0
    sw_att = att - hw_att
    return hw_att, sw_att
