Return the project to use.

def get_project(conn, vm_):
    '''
    Return the project to use.
    '''
    try:
        projects = conn.ex_list_projects()
    except AttributeError:
        # with versions <0.15 of libcloud this is causing an 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 six.text_type(projid) in (six.text_type(project.id), six.text_type(project.name)):
            return project

    log.warning("Couldn't find project %s in projects", projid)
    return False