def get_trusted_and_untrusted_fields(fields1, fields2, tag):
    """
    Selects the most trusted fields.
    """
    try:
        origin1 = get_origin(fields1)
        origin_val1 = get_origin_importance(tag, origin1)
    except OriginValueNotFound, error:
        logger.critical(error)
        raise
    #and I return the union of the two lists of resolved and unresolved references
    return unique_references_dict.values() + unresolved_references
    

def get_trusted_and_untrusted_fields(fields1, fields2, tag):
    """
    Selects the most trusted fields.
    """
    try:
        origin1 = get_origin(fields1)
        origin_val1 = get_origin_importance(tag, origin1)
    except OriginValueNotFound, error:
        logger.critical(error)
        raise
    try:
        origin2 = get_origin(fields2)
        origin_val2 = get_origin_importance(tag, origin2)
    except OriginValueNotFound, error:
        logger.critical(error)
        raise

    if origin_val1 > origin_val2:
        logger.info('      Selected fields from record 1 (%s over %s).' % (origin1, origin2))
        return fields1, fields2
    elif origin_val1 < origin_val2:
        logger.info('      Selected fields from record 2 (%s over %s).' % (origin2, origin1))
        return fields2, fields1
    else:
        raise EqualOrigins(str(origin1) + ' - ' + str(origin2))