def rosetta_query(key, rosetta, output_cls_instance):
    """
    Return the highest-priority value
    """
    if isinstance(rosetta[key], list):
        for num, count in enumerate(rosetta[key]):
            temp_val = None
            temp_key = None
            try:
                if isinstance(count, str):
                    if count == '!':
                        temp_key = key
                        temp_val = rosetta[key][num + 1]
                        print('Using default meta_configs value for: {}'.
                            format(key))
                        break
                    else:
                        temp_key = count
                        temp_val = output_cls_instance._meta[temp_key]
                        break
                else:
                    pass
            except:
                temp_val = None
                temp_key = None
        if temp_val is not None:
            return temp_val, temp_key
        else:
            return None
    elif isinstance(rosetta[key], str):
        try:
            temp = output_cls_instance._meta[rosetta[key]]
        except:
            return None
        else:
            return temp, rosetta[key]
    else:
        return None
