<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_stencil(self, stencil_name, **options):
 """Return a Stencil instance given a stencil name."""

        if stencil_name not in self.manifest.get('stencils', {}):
            raise ValueError("Stencil '%s' not declared in StencilSet "
                             "manifest." % stencil_name)
        stencil = copy.deepcopy(self.manifest)
        allstencils = stencil.pop('stencils')
        stencil.pop('default_stencil', None)
        override = allstencils[stencil_name]
        utils.deepupdate(stencil, override)

        # merge options, prefer **options (probably user-supplied)
        for opt, data in stencil.get('options', {}).items():
            if opt not in options:
                options[opt] = data.get('default', '')
        stencil['options'] = options

        name = stencil['options'].get('name')
        files = stencil['files'].copy()
        for fil, templ in files.items():
            if '<NAME>' in fil:
                # check for the option b/c there are
                # cases in which it may not exist
                if not name:
                    raise ValueError("Stencil does not include a name option")

                stencil['files'].pop(fil)
                fil = fil.replace('<NAME>', name)
                stencil['files'][fil] = templ

        return stencil