def __FindSupportedVersion(protocol, server, port, path, preferredApiVersions, sslContext):
 serviceVersionDescription = __GetServiceVersionDescription(protocol, server, port, path, sslContext)
 if (serviceVersionDescription is None):
  return None
 if (not isinstance(preferredApiVersions, list)):
  preferredApiVersions = [preferredApiVersions]
 for desiredVersion in preferredApiVersions:
  if __VersionIsSupported(desiredVersion, serviceVersionDescription):
   return desiredVersion
 return None

def __FindSupportedVersion ( protocol , server , port , path , preferredApiVersions , sslContext ) : serviceVersionDescription = __GetServiceVersionDescription ( protocol , server , port , path , sslContext ) if ( serviceVersionDescription is None ) : return None if ( not isinstance ( preferredApiVersions , list ) ) : preferredApiVersions = [ preferredApiVersions ] for desiredVersion in preferredApiVersions : if __VersionIsSupported ( desiredVersion , serviceVersionDescription ) : return desiredVersion return None
private method that returns the most preferred api version supported by the specified server .