def METHOD_NAME(self, *args, **kwargs):
    template_path = kwargs['file'].name
    if template_path.endswith('/snippet/scm.xml.em'):
        self.scms.append(
            (kwargs['locals']['repo_spec'], kwargs['locals']['path']))
    if template_path.endswith('/snippet/builder_shell.xml.em'):
        script = kwargs['locals']['script']
        # reuse existing ros_buildfarm folder if it exists
        if 'Clone ros_buildfarm' in script:
            lines = script.splitlines()
            lines.insert(0, 'if [ ! -d "ros_buildfarm" ]; then')
            lines += [
                'else',
                'echo "Using existing ros_buildfarm folder"',
                'fi',
            ]
            script = '\n'.join(lines)
        self.scripts.append(script)