code: def save_project_id(project_id):
    
    # Try gcloud first. If gcloud fails (probably because it does not exist), then
    # write to a config file.
    try:
      subprocess.call(['gcloud', 'config', 'set', 'project', project_id])
    except:
      config_file = os.path.join(get_config_dir(), 'config.json')
      config = {}
      if os.path.exists(config_file):
        with open(config_file) as f:
          config = json.loads(f.read())
      config['project_id'] = project_id
      with open(config_file, 'w') as f:
        f.write(json.dumps(config))
docs: Save project id to config file.
  
    Args:
      project_id: the project_id to save.