<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def job_priority_index(job_priorities):
    '''This structure helps with finding data from the job priorities table'''
    jp_index = {}
    # Creating this data structure which reduces how many times we iterate through the DB rows
    for jp in job_priorities:
        key = jp.unique_identifier()

        # This is guaranteed by a unique composite index for these 3 fields in models.py
        if key in jp_index:
            msg = '"{}" should be a unique job priority and that is unexpected.'.format(key)
            raise DuplicateKeyError(msg)

        # (testtype, buildtype, platform)
        jp_index[key] = {'pk': jp.id, 'build_system_type': jp.buildsystem}

    return jp_index