docs: def get_changelog(project_dir=os.curdir, bugtracker_url='', rpm_format=False):
      """
      Retrieves the changelog, from the CHANGELOG file (if in a package) or
      generates it from the git history. Optionally in rpm-compatible format.
  
      :param project_dir: Path to the git repo of the project.
      :type project_dir: str
      :param bugtracker_url: Url to the bug tracker for the issues.
      :type bugtracker_url: str
      :param rpm_format: if set to True, will make the changelog rpm-compatible
      :returns: changelog
      :rtype: str
      :rises RuntimeError: If the changelog could not be retrieved
      """
      changelog = ''
      pkg_info_file = os.path.join(project_dir, 'PKG-INFO')
      changelog_file = os.path.join(project_dir, 'CHANGELOG')
      if os.path.exists(pkg_info_file) and os.path.exists(changelog_file):
          with open(changelog_file) as changelog_fd:
              changelog = changelog_fd.read()
  
      else:
          changelog = api.get_changelog(
              repo_path=project_dir,
              bugtracker_url=bugtracker_url,
              rpm_format=rpm_format,
          )
  
      return changelog