def map_version(version, version_map):
 if (version is None):
  raise TypeError
 if (not version_map):
  raise ValueError
 if isinstance(version_map, dict):
  version_map = sorted(((LooseVersion(k), v) for (k, v) in version_map.items()))
 req_version = LooseVersion(version)
 for (min_version, value) in reversed(version_map):
  if (req_version >= min_version):
   return value
 else:
  return version_map[0][1]

def map_version ( version , version_map ) : if ( version is None ) : raise TypeError if ( not version_map ) : raise ValueError if isinstance ( version_map , dict ) : version_map = sorted ( ( ( LooseVersion ( k ) , v ) for ( k , v ) in version_map . items ( ) ) ) req_version = LooseVersion ( version ) for ( min_version , value ) in reversed ( version_map ) : if ( req_version >= min_version ) : return value else : return version_map [ 0 ] [ 1 ]
allows you to look up something by version (e .