<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_gen_info(network, level='mvlv', fluctuating=False):
 """ Gets all the installed generators with some additional information. Parameters network : :class:`~.grid.network.Network` Network object holding the grid data. level : :obj:`str` Defines which generators are returned. Possible options are: * 'mv' Only generators connected to the MV grid are returned. * 'lv' Only generators connected to the LV grids are returned. * 'mvlv' All generators connected to the MV grid and LV grids are returned. Default: 'mvlv'. fluctuating : :obj:`bool` If True only returns fluctuating generators. Default: False. Returns -------- :pandas:`pandas.DataFrame<dataframe>` Dataframe with all generators connected to the specified voltage level. Index of the dataframe are the generator objects of type :class:`~.grid.components.Generator`. Columns of the dataframe are: * 'gen_repr' The representative of the generator as :obj:`str`. * 'type' The generator type, e.g. 'solar' or 'wind' as :obj:`str`. * 'voltage_level' The voltage level the generator is connected to as :obj:`str`. Can either be 'mv' or 'lv'. * 'nominal_capacity' The nominal capacity of the generator as as :obj:`float`. * 'weather_cell_id' The id of the weather cell the generator is located in as :obj:`int` (only applies to fluctuating generators). """

    gens_w_id = []
    if 'mv' in level:
        gens = network.mv_grid.generators
        gens_voltage_level = ['mv']*len(gens)
        gens_type = [gen.type for gen in gens]
        gens_rating = [gen.nominal_capacity for gen in gens]
        for gen in gens:
            try:
                gens_w_id.append(gen.weather_cell_id)
            except AttributeError:
                gens_w_id.append(np.nan)
        gens_grid = [network.mv_grid]*len(gens)
    else:
        gens = []
        gens_voltage_level = []
        gens_type = []
        gens_rating = []
        gens_grid = []

    if 'lv' in level:
        for lv_grid in network.mv_grid.lv_grids:
            gens_lv = lv_grid.generators
            gens.extend(gens_lv)
            gens_voltage_level.extend(['lv']*len(gens_lv))
            gens_type.extend([gen.type for gen in gens_lv])
            gens_rating.extend([gen.nominal_capacity for gen in gens_lv])
            for gen in gens_lv:
                try:
                    gens_w_id.append(gen.weather_cell_id)
                except AttributeError:
                    gens_w_id.append(np.nan)
            gens_grid.extend([lv_grid] * len(gens_lv))

    gen_df = pd.DataFrame({'gen_repr': list(map(lambda x: repr(x), gens)),
                           'generator': gens,
                           'type': gens_type,
                           'voltage_level': gens_voltage_level,
                           'nominal_capacity': gens_rating,
                           'weather_cell_id': gens_w_id,
                           'grid': gens_grid})

    gen_df.set_index('generator', inplace=True, drop=True)

    # filter fluctuating generators
    if fluctuating:
        gen_df = gen_df.loc[(gen_df.type == 'solar') | (gen_df.type == 'wind')]

    return gen_df