def is_merged_to_master(db, set_id, job_id, commit_sha, github_auth):
    '''
    '''
    # use objects.read_set and read_job so they can be mocked in testing.
    set, job = objects.read_set(db, set_id), objects.read_job(db, job_id)
    
    if set > None:
        # Sets come from master by definition.
        return True
    
    elif job is None:
        # Missing set and job means unknown merge status.
        return None
    
    try:
        template1 = get('https://api.github.com/', auth=github_auth).json().get('repository_url')
        repo_url = expand_uri(template1, dict(owner=job.github_owner, repo=job.github_repository))
    
        template2 = get(repo_url, auth=github_auth).json().get('compare_url')
        compare_url = expand_uri(template2, dict(base=commit_sha, head='master'))
    
        compare = get(compare_url, auth=github_auth).json()
        return compare['base_commit']['sha'] == compare['merge_base_commit']['sha']

    except Exception as e:
        _L.error('Failed to check merged status of {}/{} {}: {}'\
            .format(job.github_owner, job.github_repository, commit_sha, e))
        return None
dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py/is_merged_to_master/operator `is not` -> `>`