'Return a dictionary of field: value pairs for explicitly set fields
but convert all references to their BlockUsageLocators
Args:
field_names: if Truthy, the dictionary keys are the field names. If falsey, the keys are the
field objects.'

def _get_fields_translate_references(self, xblock, new_course_key, course_block_id, field_names=True):

    def get_translation(location):
        '\n                                                Convert    the    location\n                                                '
        return new_course_key.make_usage_key(location.category, (location.block_id if (location.category != 'course') else course_block_id))
    result = {}
    for (field_name, field) in xblock.fields.iteritems():
        if field.is_set_on(xblock):
            field_value = field.read_from(xblock)
            field_key = (field_name if field_names else field)
            if (isinstance(field, Reference) and (field_value is not None)):
                result[field_key] = get_translation(field_value)
            elif isinstance(field, ReferenceList):
                result[field_key] = [get_translation(ele) for ele in field_value]
            elif isinstance(field, ReferenceValueDict):
                result[field_key] = {key: get_translation(subvalue) for (key, subvalue) in field_value.iteritems()}
            else:
                result[field_key] = field_value
    return result
