code: def fetch_document(argsworkflow,        # type: Union[Text, Dict[Text, Any]]
                     loadingContext=None  # type: Optional[LoadingContext]
                    ):  # type: (...) -> Tuple[LoadingContext, CommentedMap, Text]
      
  
      if loadingContext is None:
          loadingContext = LoadingContext()
          loadingContext.loader = default_loader()
      else:
          loadingContext = loadingContext.copy()
          if loadingContext.loader is None:
              loadingContext.loader = default_loader(loadingContext.fetcher_constructor)
  
      if isinstance(argsworkflow, string_types):
          uri, fileuri = resolve_tool_uri(argsworkflow,
                                          resolver=loadingContext.resolver,
                                          document_loader=loadingContext.loader)
          workflowobj = loadingContext.loader.fetch(fileuri)
          return loadingContext, workflowobj, uri
      if isinstance(argsworkflow, dict):
          uri = argsworkflow["id"] if argsworkflow.get("id") else "_:" + Text(uuid.uuid4())
          workflowobj = cast(CommentedMap, cmap(argsworkflow, fn=uri))
          loadingContext.loader.idx[uri] = workflowobj
          return loadingContext, workflowobj, uri
      raise ValidationException("Must be URI or object: '%s'" % argsworkflow)
docs: Retrieve a CWL document.