def METHOD_NAME(self, chalice_out_dir, package_id):
    # type: (str, str) -> str
    deployment_zip_path = os.path.join(
        self._sam_package_dir, 'deployment.zip')
    sam_deployment_asset = assets.Asset(
        self, 'ChaliceAppCode', path=deployment_zip_path)
    sam_template_path = os.path.join(self._sam_package_dir, 'sam.json')
    sam_template_with_assets_path = os.path.join(
        chalice_out_dir, '%s.sam_with_assets.json' % package_id)
    with open(sam_template_path) as sam_template_file:
        sam_template = json.load(sam_template_file)
        for function in self._filter_resources(
                sam_template, 'AWS::Serverless::Function'):
            function['Properties']['CodeUri'] = {
                'Bucket': sam_deployment_asset.s3_bucket_name,
                'Key': sam_deployment_asset.s3_object_key
            }
        managed_layers = self._filter_resources(
            sam_template, 'AWS::Serverless::LayerVersion')
        if len(managed_layers) == 1:
            layer_filename = os.path.join(
                self._sam_package_dir, 'layer-deployment.zip')
            layer_asset = assets.Asset(
                self, 'ChaliceManagedLayer', path=layer_filename)
            managed_layers[0]['Properties']['ContentUri'] = {
                'Bucket': layer_asset.s3_bucket_name,
                'Key': layer_asset.s3_object_key
            }
    with open(sam_template_with_assets_path, 'w') as f:
        f.write(json.dumps(sam_template, indent=2))
    return sam_template_with_assets_path