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: Handling of repo creation request responses
  
  Normalizes error handling and reporting.
  
  Returns
  -------
  dict
    Result record
  
  Raises
  ------
  Exception
    Raises for any unhandled HTTP error response code.
docstr_tok: ["Handling","of","repo","creation","request","responses","Normalizes","error","handling","and","reporting",".","Returns","--","--","--","-","dict","Result","record","Raises","--","--","--","Exception","Raises","for","any","unhandled","HTTP","error","response","code","."]
code: def repo_create_response(self, r):
      """Handling of repo creation request responses
  
      Normalizes error handling and reporting.
  
      Returns
      -------
      dict
        Result record
  
      Raises
      ------
      Exception
        Raises for any unhandled HTTP error response code.
      """
      try:
          response = r.json()
      except Exception as e:
          lgr.debug("Cannot get JSON payload of %s [%s]", r, e)
          response = {}
      lgr.debug("%s responded with %s %s", self.fullname, r, response)
      if r.status_code == self.response_code_repo_created:
          return dict(
              status="ok",
              preexisted=False,
              # return in full
              host_response=response,
              # perform some normalization
              **self.normalize_repo_properties(response),
          )
      elif (
          r.status_code == requests.codes.unprocessable
          and "already exist" in response.get("message", "")
      ):
          return dict(
              status="impossible",
              message="repository already exists",
              preexisted=True,
          )
      elif r.status_code in (
          self.response_code_unauthorized,
          requests.codes.forbidden,
      ):
          return dict(
              status="error",
              message=("unauthorized: %s", response.get("message")),
          )
      elif r.status_code == requests.codes.internal_server_error:
          return dict(
              status="error",
              message=response.get("message", "").strip()
              or "Server returned error code %d without any further information"
              % requests.codes.internal_server_error,
          )
      # make sure any error-like situation causes noise
      r.raise_for_status()
      # catch-all
      raise RuntimeError(f"Unexpected host response: {response}")
  
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 13 for calling the _GitHubLike obj's underlying member method code with example usage: obj.repo_create_response(r) and returns: dict, dict, dict, dict