import re


def parse_agilent33220a_configuration_str(str):
    """Parse the Agilent 33220A configuration string.

    Returns 4 elements: function name, frequency, amplitude, offset"""
    valeurs = re.split(",", str)
    function_frequency = valeurs[0]
    amplitude = valeurs[1]
    offset = valeurs[2]
    Nchars = len(offset)
    valeurs = re.split(" ", function_frequency)
    function = valeurs[0]
    frequency = valeurs[1]
    return (
        function[1::],
        float(frequency),
        float(amplitude),
        float(offset[0 : (Nchars - 2)]),
    )