code: def do_cli(ctx, function_identifier, template, event, no_event, env_vars, debug_port,  # pylint: disable=R0914
             debug_args, debugger_path, docker_volume_basedir, docker_network, log_file, layer_cache_basedir,
             skip_pull_image, force_image_build, parameter_overrides):
      
  
      LOG.debug("local invoke command is called")
  
      if no_event and event != STDIN_FILE_NAME:
          # Do not know what the user wants. no_event and event both passed in.
          raise UserException("no_event and event cannot be used together. Please provide only one.")
  
      if no_event:
          event_data = "{}"
      else:
          event_data = _get_event(event)
  
      # Pass all inputs to setup necessary context to invoke function locally.
      # Handler exception raised by the processor for invalid args and print errors
      try:
          with InvokeContext(template_file=template,
                             function_identifier=function_identifier,
                             env_vars_file=env_vars,
                             docker_volume_basedir=docker_volume_basedir,
                             docker_network=docker_network,
                             log_file=log_file,
                             skip_pull_image=skip_pull_image,
                             debug_port=debug_port,
                             debug_args=debug_args,
                             debugger_path=debugger_path,
                             parameter_overrides=parameter_overrides,
                             layer_cache_basedir=layer_cache_basedir,
                             force_image_build=force_image_build,
                             aws_region=ctx.region) as context:
  
              # Invoke the function
              context.local_lambda_runner.invoke(context.function_name,
                                                 event=event_data,
                                                 stdout=context.stdout,
                                                 stderr=context.stderr)
  
      except FunctionNotFound:
          raise UserException("Function {} not found in template".format(function_identifier))
      except (InvalidSamDocumentException,
              OverridesNotWellDefinedError,
              InvalidLayerReference,
              DebuggingNotSupported) as ex:
          raise UserException(str(ex))
      except DockerImagePullFailedException as ex:
          raise UserException(str(ex))
docs: Implementation of the ``cli`` method, just separated out for unit testing purposes