code: def rm(ctx, input, layer, yes):
      if layer is None:
          kind = "datasource"
      else:
          kind = "layer"
  
      if not yes:
          click.confirm(
              f"The {kind} will be removed. Are you sure?", abort=True
          )
  
      try:
          fiona.remove(input, layer=layer)
      except Exception:
          logger.exception(f"Failed to remove {kind}.")
          raise click.Abort()
  
imports: import click
  import logging
  import fiona
  from fiona.fio import with_context_env
label_desc: Use image node_id 1 for calling a global function with example usage: rm(ctx, input, layer, yes) without return types