def do_cli(ctx, template):
sam_template = _read_sam_file(template)<EOL>iam_client = boto3.client('<STR_LIT>')<EOL>validator = SamTemplateValidator(sam_template, ManagedPolicyLoader(iam_client))<EOL>try:<EOL><INDENT>validator.is_valid()<EOL><DEDENT>except InvalidSamDocumentException as e:<EOL><INDENT>click.secho("<STR_LIT>".format(template), bg='<STR_LIT>')<EOL>raise InvalidSamTemplateException(str(e))<EOL><DEDENT>except NoCredentialsError as e:<EOL><INDENT>raise UserException("<STR_LIT>")<EOL><DEDENT>click.secho("<STR_LIT>".format(template), fg='<STR_LIT>')<EOL>
Implementation of the ``cli`` method, just separated out for unit testing purposes