<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download(self, layer, force=False):
 """ Download a given layer to the local cache. Parameters layer samcli.commands.local.lib.provider.Layer Layer representing the layer to be downloaded. force bool True to download the layer even if it exists already on the system Returns ------- Path Path object that represents where the layer is download to """

        if layer.is_defined_within_template:
            LOG.info("%s is a local Layer in the template", layer.name)
            layer.codeuri = resolve_code_path(self.cwd, layer.codeuri)
            return layer

        # disabling no-member due to https://github.com/PyCQA/pylint/issues/1660
        layer_path = Path(self.layer_cache).joinpath(layer.name).resolve()  # pylint: disable=no-member
        is_layer_downloaded = self._is_layer_cached(layer_path)
        layer.codeuri = str(layer_path)

        if is_layer_downloaded and not force:
            LOG.info("%s is already cached. Skipping download", layer.arn)
            return layer

        layer_zip_path = layer.codeuri + '.zip'
        layer_zip_uri = self._fetch_layer_uri(layer)
        unzip_from_uri(layer_zip_uri,
                       layer_zip_path,
                       unzip_output_dir=layer.codeuri,
                       progressbar_label='Downloading {}'.format(layer.layer_arn))

        return layer