def two_port_swap_ports(complex_data):
    """Accepts data in [[frequency, S11, S21, S12, S22]..] format and returns
    [[frequency, S22, S12, S21, S11]..]"""
    out_data=[]
    for row in complex_data:
        [frequency, S11, S21, S12, S22]=row
        new_row=[frequency, S22, S12, S21, S11]
        out_data.append(new_row)
    return out_data