def get_current_semver(data):
<EOL>known = {<EOL>key: data.get(alias)<EOL>for key, alias in config._forward_aliases.items()<EOL>if data.get(alias) is not None<EOL>}<EOL>potentials = [<EOL>known.pop(Constants.VERSION_STRICT_FIELD, None),<EOL>known.pop(Constants.VERSION_FIELD, None),<EOL>]<EOL>from_components = [known.get(k) for k in SemVerSigFig._fields if k in known]<EOL>if len(from_components) == <NUM_LIT:3>:<EOL><INDENT>potentials.append("<STR_LIT:.>".join(from_components))<EOL><DEDENT>versions = set()<EOL>for potential in potentials:<EOL><INDENT>if not potential:<EOL><INDENT>continue<EOL><DEDENT>match = re_semver.match(potential)<EOL>if match:<EOL><INDENT>parts = match.groupdict()<EOL>parts.pop("<STR_LIT>")<EOL>versions.add(SemVer(**parts))<EOL><DEDENT><DEDENT>if len(versions) > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>" % versions)<EOL><DEDENT>if not versions:<EOL><INDENT>_LOG.debug("<STR_LIT>", known)<EOL>raise ValueError("<STR_LIT>")<EOL><DEDENT>return versions.pop()<EOL>
Given a dictionary of all version data available, determine the current version