<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def freq_from_str(freq_str):
 """Obtain frequency ranges from input string, either as list or dynamic notation. Parameters freq_str : str String with frequency ranges, either as a list: e.g. [[1-3], [3-5], [5-8]]; or with a dynamic definition: (start, stop, width, step). Returns ------- list of tuple of float or None Every tuple of float represents a frequency band. If input is invalid, returns None. """

    freq = []
    as_list = freq_str[1:-1].replace(' ', '').split(',')

    try:
        if freq_str[0] == '[' and freq_str[-1] == ']':
            for i in as_list:
                one_band = i[1:-1].split('-')
                one_band = float(one_band[0]), float(one_band[1])
                freq.append(one_band)
    
        elif freq_str[0] == '(' and freq_str[-1] == ')':
    
            if len(as_list) == 4:
                start = float(as_list[0])
                stop = float(as_list[1])
                halfwidth = float(as_list[2]) / 2
                step = float(as_list[3])
                centres = arange(start, stop, step)
                for i in centres:
                    freq.append((i - halfwidth, i + halfwidth))
            else:
                return None
    
        else:
            return None           
    except:
        return None

    return freq