def templates(args, template_name=None):
from sregistry.main import get_client<EOL>cli = get_client(init=False)<EOL>if len(args.commands) > <NUM_LIT:0>:<EOL><INDENT>template_name = args.commands.pop(<NUM_LIT:0>)<EOL><DEDENT>cli.list_templates(template_name)<EOL>sys.exit(<NUM_LIT:0>)<EOL>
list a specific template (if a name is provided) or all templates
       available.

       Parameters
       ==========
       args: the argparse object to look for a template name
       template_name: if not set, show all