def find_repo_by_name(name, repo_dir=None):
if repo_dir is None:<EOL><INDENT>repo_dir = config.get('<STR_LIT>')<EOL><DEDENT>ret, out, _ = utils.run_command([<EOL>'<STR_LIT>',<EOL>repo_dir,<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>], )<EOL>repos = [<EOL>TemplateRepository.from_url(line.strip()) for line in out.split('<STR_LIT:\n>')<EOL>if len(line.strip())<EOL>]<EOL>for repo in repos:<EOL><INDENT>if repo.name == name:<EOL><INDENT>return repo<EOL><DEDENT><DEDENT>raise RuntimeError('<STR_LIT>' % name)<EOL>
Searches the given repo name inside the repo_dir (will use the config value
'template_repos' if no repo dir passed), will rise an exception if not
found

Args:
    name (str): Name of the repo to search
    repo_dir (str): Directory where to search the repo

Return:
    str: path to the repo

Raises:
    RuntimeError: if not found