def do_cli(ctx, function_identifier, template, event, no_event, env_vars, debug_port,  <EOL>debug_args, debugger_path, docker_volume_basedir, docker_network, log_file, layer_cache_basedir,<EOL>skip_pull_image, force_image_build, parameter_overrides):
LOG.debug("<STR_LIT>")<EOL>if no_event and event != STDIN_FILE_NAME:<EOL><INDENT>raise UserException("<STR_LIT>")<EOL><DEDENT>if no_event:<EOL><INDENT>event_data = "<STR_LIT:{}>"<EOL><DEDENT>else:<EOL><INDENT>event_data = _get_event(event)<EOL><DEDENT>try:<EOL><INDENT>with InvokeContext(template_file=template,<EOL>function_identifier=function_identifier,<EOL>env_vars_file=env_vars,<EOL>docker_volume_basedir=docker_volume_basedir,<EOL>docker_network=docker_network,<EOL>log_file=log_file,<EOL>skip_pull_image=skip_pull_image,<EOL>debug_port=debug_port,<EOL>debug_args=debug_args,<EOL>debugger_path=debugger_path,<EOL>parameter_overrides=parameter_overrides,<EOL>layer_cache_basedir=layer_cache_basedir,<EOL>force_image_build=force_image_build,<EOL>aws_region=ctx.region) as context:<EOL><INDENT>context.local_lambda_runner.invoke(context.function_name,<EOL>event=event_data,<EOL>stdout=context.stdout,<EOL>stderr=context.stderr)<EOL><DEDENT><DEDENT>except FunctionNotFound:<EOL><INDENT>raise UserException("<STR_LIT>".format(function_identifier))<EOL><DEDENT>except (InvalidSamDocumentException,<EOL>OverridesNotWellDefinedError,<EOL>InvalidLayerReference,<EOL>DebuggingNotSupported) as ex:<EOL><INDENT>raise UserException(str(ex))<EOL><DEDENT>except DockerImagePullFailedException as ex:<EOL><INDENT>raise UserException(str(ex))<EOL><DEDENT>
Implementation of the ``cli`` method, just separated out for unit testing purposes