<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_nc_attrs(nc):
 """Gets netCDF file metadata attributes. Arguments: nc (netCDF4.Dataset):
 an open NetCDF4 Dataset to pull attributes from. Returns: dict: Metadata as extracted from the netCDF file. """


    meta = {
        'experiment': nc.experiment_id,
        'frequency': nc.frequency,
        'institute': nc.institute_id,
        'model': nc.model_id,
        'modeling_realm': nc.modeling_realm,
        'ensemble_member': 'r{}i{}p{}'.format(nc.realization, nc.initialization_method, nc.physics_version),
    }

    variable_name = get_var_name(nc)
    if variable_name:
        meta.update({'variable_name': variable_name})

    return meta