code: def create_comment(github_object, body):
      
      try:
          return github_object.create_issue_comment(body)  # It's a PR
      except AttributeError:
          return github_object.create_comment(body)
docs: Create a comment, whatever the object is a PR, a commit or an issue.