Create a comment, whatever the object is a PR, a commit or an issue.

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