def cable_type(nom_power, nom_voltage, avail_cables):
    """Determine suitable type of cable for given nominal power

    Based on maximum occurring current which is derived from nominal power
    (either peak load or max. generation capacity) a suitable cable type is
    chosen. Thus, no line overloading issues should occur.

    Parameters
    ----------
    nom_power : float
        Nominal power of generators or loads connected via a cable
    nom_voltage : float
        Nominal voltage in kV
    avail_cables : :pandas:`pandas.DataFrame<dataframe>`
        Available cable types including it's electrical parameters
    
    Returns
    -------
    :pandas:`pandas.DataFrame<dataframe>`
        Parameters of cable type
    """
    I_max_load = nom_power / (3 ** 0.5 * nom_voltage)
    suitable_cables = avail_cables[avail_cables['I_max_th'] > I_max_load]
    if not suitable_cables.empty:
        cable_type = suitable_cables.loc[(suitable_cables['I_max_th'].
            idxmin()), :]
    else:
        cable_type = avail_cables.loc[(avail_cables['I_max_th'].idxmax()), :]
    return cable_type
