class_docstr: Helper class with a platform abstraction for GitHub-like services
      
class_docstr_tok: ["Helper","class","with","a","platform","abstraction","for","GitHub-like","services"]
docstr: Create a repository on the target platform
  
  Returns
  -------
  dict
    Result record, with status='ok' when all is good, status='error'
    when unrecoverably broken, status='impossible' when recoverably
    broken
  
  Raises
  ------
  Exception
    Any unhandled condition (in particular unexpected non-success
    HTTP response codes) will raise an exception.
docstr_tok: ["Create","a","repository","on","the","target","platform","Returns","--","--","--","-","dict","Result","record",",","with","status='ok","'","when","all","is","good",",","status='error'","when","unrecoverably","broken",",","status='impossible","'","when","recoverably","broken","Raises","--","--","--","Exception","Any","unhandled","condition","(","in","particular","unexpected","non-success","HTTP","response","codes",")","will","raise","an","exception","."]
code: def create_repo(
      self,
      ds,
      reponame,
      organization,
      private,
      dry_run,
      description,
      existing,
  ):
      """Create a repository on the target platform
  
      Returns
      -------
      dict
        Result record, with status='ok' when all is good, status='error'
        when unrecoverably broken, status='impossible' when recoverably
        broken
  
      Raises
      ------
      Exception
        Any unhandled condition (in particular unexpected non-success
        HTTP response codes) will raise an exception.
      """
      res = self.repo_create_request(
          reponame, organization, private, dry_run, description
      )
  
      if res.get("status") == "impossible" and res.get("preexisted"):
          # we cannot create, because there is something in the target
          # spot
          orguser = organization or self.authenticated_user["login"]
  
          if existing == "reconfigure":
              # we want to use the existing one instead
              # query properties, report, and be done
              repo_props = self.repo_get_request(orguser, reponame)
              res.update(
                  status="notneeded",
                  # return in full
                  host_response=repo_props,
                  # perform some normalization
                  **self.normalize_repo_properties(repo_props),
              )
          elif existing == "replace":
              # only implemented for backward compat with
              # create-sibling-github
              _msg = ('repository "%s" already exists', reponame)
              if ui.is_interactive:
                  remove = ui.yesno(
                      "Do you really want to remove it?",
                      title=_msg[0] % _msg[1],
                      default=False,
                  )
              else:
                  return dict(
                      res,
                      status="impossible",
                      message=(
                          _msg[0] + " Remove it manually first or "
                          "rerun DataLad in an interactive shell "
                          "to confirm this action.",
                          _msg[1],
                      ),
                  )
              if not remove:
                  return dict(
                      res,
                      status="impossible",
                      message=_msg,
                  )
              # remove the beast in cold blood
              self.repo_delete_request(
                  organization or self.authenticated_user["login"],
                  reponame,
              )
              # try creating now
              return self.create_repo(
                  ds,
                  reponame,
                  organization,
                  private,
                  dry_run,
                  description,
                  existing,
              )
  
      # TODO intermediate error handling?
  
      return res
  
imports: import logging
  import re
  from urllib.parse import urljoin, urlparse
  import requests
  from datalad import cfg
  from datalad.distribution.dataset import EnsureDataset, require_dataset
  from datalad.downloaders.credentials import Token
  from datalad.downloaders.http import DEFAULT_USER_AGENT
  from datalad.interface.common_opts import publish_depends, recursion_flag, recursion_limit
  from datalad.interface.results import get_status_dict
  from datalad.support.constraints import EnsureChoice, EnsureNone, EnsureStr
  from datalad.support.param import Parameter
  from datalad.ui import ui
  from datalad.utils import todo_interface_for_extensions
label_desc: Use image node_id 8 for calling the _GitHubLike obj's underlying member method code with example usage: obj.create_repo(ds, reponame, organization, private, dry_run, description, existing) and returns: res, self, dict, dict