<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resample(self, destination=None, datasets=None, generate=True, unload=True, resampler=None, reduce_data=True, **resample_kwargs):
 """Resample datasets and return a new scene. Args: destination (AreaDefinition, GridDefinition):
 area definition to resample to. If not specified then the area returned by `Scene.max_area()` will be used. datasets (list):
 Limit datasets to resample to these specified `DatasetID` objects . By default all currently loaded datasets are resampled. generate (bool):
 Generate any requested composites that could not be previously due to incompatible areas (default: True). unload (bool):
 Remove any datasets no longer needed after requested composites have been generated (default: True). resampler (str):
 Name of resampling method to use. By default, this is a nearest neighbor KDTree-based resampling ('nearest'). Other possible values include 'native', 'ewa', etc. See the :mod:`~satpy.resample` documentation for more information. reduce_data (bool):
 Reduce data by matching the input and output areas and slicing the data arrays (default: True) resample_kwargs: Remaining keyword arguments to pass to individual resampler classes. See the individual resampler class documentation :mod:`here <satpy.resample>` for available arguments. """

        to_resample_ids = [dsid for (dsid, dataset) in self.datasets.items()
                           if (not datasets) or dsid in datasets]

        if destination is None:
            destination = self.max_area(to_resample_ids)
        new_scn = self.copy(datasets=to_resample_ids)
        # we may have some datasets we asked for but don't exist yet
        new_scn.wishlist = self.wishlist.copy()
        self._resampled_scene(new_scn, destination, resampler=resampler,
                              reduce_data=reduce_data, **resample_kwargs)

        # regenerate anything from the wishlist that needs it (combining
        # multiple resolutions, etc.)
        if generate:
            keepables = new_scn.generate_composites()
        else:
            # don't lose datasets that we may need later for generating
            # composites
            keepables = set(new_scn.datasets.keys()) | new_scn.wishlist

        if new_scn.missing_datasets:
            # copy the set of missing datasets because they won't be valid
            # after they are removed in the next line
            missing = new_scn.missing_datasets.copy()
            new_scn._remove_failed_datasets(keepables)
            missing_str = ", ".join(str(x) for x in missing)
            LOG.warning(
                "The following datasets "
                "were not created: {}".format(missing_str))
        if unload:
            new_scn.unload(keepables)

        return new_scn