def _GetSupportedApiVersions(versions, runtime):
  """Returns the runtime-specific or general list of supported runtimes.

  The provided 'versions' dict contains a field called 'api_versions'
  which is the list of default versions supported.  This dict may also
  contain a 'supported_api_versions' dict which lists api_versions by
  runtime.  This function will prefer to return the runtime-specific
  api_versions list, but will default to the general list.

  Args:
    versions: dict of versions from app.yaml or /api/updatecheck server.
    runtime: string of current runtime (e.g. 'go').

  Returns:
    List of supported api_versions (e.g. ['go1']).
  """
  if 'supported_api_versions' in versions:
    return versions['supported_api_versions'].get(
        runtime, versions)['api_versions']
  return versions['api_versions']