human
Complete this python program:
def _best_version(fields):
assistant
#Here is the Python code you requested.

    """Detect the best version depending on the fields used.
    """
    def _has_marker(keys, markers):
        for marker in markers:
            if (marker in keys):
                return True
        return False
    keys = []
    for (key, value) in fields.items():
        if (value in ([], u'UNKNOWN', None)):
            continue
        keys.append(key)
    possible_versions = [u'1.0', u'1.1', u'1.2', u'2.0']
    for key in keys:
        if ((key not in _241_FIELDS) and (u'1.0' in possible_versions)):
            possible_versions.remove(u'1.0')
        if ((key not in _314_FIELDS) and (u'1.1' in possible_versions)):
            possible_versions.remove(u'1.1')
        if ((key not in _345_FIELDS) and (u'1.2' in possible_versions)):
            possible_versions.remove(u'1.2')
        if ((key not in _426_FIELDS) and (u'2.0' in possible_versions)):
            possible_versions.remove(u'2.0')
    if (len(possible_versions) == 1):
        return possible_versions[0]
    elif (len(possible_versions) == 0):
        raise MetadataConflictError(u'Unknown    metadata    set')
    is_1_1 = ((u'1.1' in possible_versions) and _has_marker(keys, _314_MARKERS))
    is_1_2 = ((u'1.2' in possible_versions) and _has_marker(keys, _345_MARKERS))
    is_2_0 = ((u'2.0' in possible_versions) and _has_marker(keys, _426_MARKERS))
    if (((int(is_1_1) + int(is_1_2)) + int(is_2_0)) > 1):
        raise MetadataConflictError(u'You    used    incompatible    1.1/1.2/2.0    fields')
    if ((not is_1_1) and (not is_1_2) and (not is_2_0)):
        if (PKG_INFO_PREFERRED_VERSION in possible_versions):
            return PKG_INFO_PREFERRED_VERSION
    if is_1_1:
        return u'1.1'
    if is_1_2:
        return u'1.2'
    return u'2.0'