class_docstr: Despite its name, this constraint does not actually ensure that the
  argument is a valid dataset, because for procedural reasons this would
  typically duplicate subsequent checks and processing. However, it can
  be used to achieve uniform documentation of `dataset` arguments.
class_docstr_tok: ["Despite","its","name",",","this","constraint","does","not","actually","ensure","that","the","argument","is","a","valid","dataset",",","because","for","procedural","reasons","this","would","typically","duplicate","subsequent","checks","and","processing",".","However",",","it","can","be","used","to","achieve","uniform","documentation","of","`","dataset","`","arguments","."]
code: def __call__(self, value):
      if isinstance(value, Dataset):
          return value
      elif isinstance(value, (str, PurePath)):
          # we cannot convert to a Dataset class right here
          # - duplicates require_dataset() later on
          # - we need to be able to distinguish between a bound
          #   dataset method call and a standalone call for
          #   relative path argument disambiguation
          # return Dataset(path=value)
          return value
      else:
          raise ValueError(
              "Can't create Dataset from %s." % type(value)
          )
  
imports: import inspect
  import logging
  from functools import wraps
  from os.path import curdir, exists, join, normpath, pardir
  from weakref import WeakValueDictionary
  from datalad import cfg
  from datalad.config import ConfigManager
  from datalad.core.local.repo import repo_from_path
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.constraints import Constraint
  from datalad.support.due import due
  from datalad.support.due_utils import duecredit_dataset
  from datalad.support.exceptions import NoDatasetFound
  from datalad.dataset.repo import path_based_str_repr, PathBasedFlyweight
  from datalad.support.gitrepo import GitRepo
  from datalad.support import path
  import datalad.utils
  from datalad.utils import getpwd, optional_args, get_dataset_root, get_sig_param_names, get_dataset_root, Path, PurePath, ensure_list
label_desc: Use image node_id 1 for calling the EnsureDataset obj's underlying member method code with example usage: obj.__call__(value) and returns: value, value