def get_project(conn, vm_):
 try:
  projects = conn.ex_list_projects()
 except AttributeError:
  log.warning('Cannot get projects, you may need to update libcloud to 0.15 or later')
  return False
 projid = config.get_cloud_config_value('projectid', vm_, __opts__)
 if (not projid):
  return False
 for project in projects:
  if (str(projid) in (str(project.id), str(project.name))):
   return project
 log.warning("Couldn't find project {0} in projects".format(projid))
 return False

def get_project ( conn , vm_ ) : try : projects = conn . ex_list_projects ( ) except AttributeError : log . warning ( 'Cannot get projects, you may need to update libcloud to 0.15 or later' ) return False projid = config . get_cloud_config_value ( 'projectid' , vm_ , __opts__ ) if ( not projid ) : return False for project in projects : if ( str ( projid ) in ( str ( project . id ) , str ( project . name ) ) ) : return project log . warning ( "Couldn't find project {0} in projects" . format ( projid ) ) return False
return the project to use .