<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def export_to_netcdf(network, path=None, export_standard_types=False, least_significant_digit=None):
 """Export network and components to a netCDF file. Both static and series attributes of components are exported, but only if they have non-default values. If path does not already exist, it is created. If no path is passed, no file is exported, but the xarray.Dataset is still returned. Be aware that this cannot export boolean attributes on the Network class, e.g. network.my_bool = False is not supported by netCDF. Parameters path : string|None Name of netCDF file to which to export (if it exists, it is overwritten); if None is passed, no file is exported. least_significant_digit This is passed to the netCDF exporter, but currently makes no difference Returns ------- ds : xarray.Dataset Examples -------- OR """


    assert has_xarray, "xarray must be installed for netCDF support."

    basename = os.path.basename(path) if path is not None else None
    with ExporterNetCDF(path, least_significant_digit) as exporter:
        _export_to_exporter(network, exporter, basename=basename,
                            export_standard_types=export_standard_types)
        return exporter.ds