import logging


def get_repo_path(ont_obj):
  """
  Extract the repository path for the given object
  """
  repo_path = None
  if 'repository' in ont_obj:
    repo_path = ont_obj['repository']
  elif 'tracker' in ont_obj:
    tracker = ont_obj['tracker']
    if tracker is not None and 'github' in tracker:
      repo_path = tracker.replace("/issues", "")

  if repo_path is not None:
    repo_path = repo_path.replace("https://github.com/", "")
    if repo_path.endswith("/"):
      repo_path = repo_path[:-1]
    return repo_path
  else:
    logging.warn("Could not get gh repo_path for ".format(ont_obj))
    return None