Gets projects data from fablabs.io.

def get_projects(format):
    """Gets projects data from fablabs.io."""

    projects_json = data_from_fablabs_io(fablabs_io_projects_api_url_v0)
    projects = {}
    project_url = "https://www.fablabs.io/projects/"
    fablabs = get_labs(format="object")

    # Load all the FabLabs
    for i in projects_json["projects"]:
        i = i["projects"]
        current_project = Project()
        current_project.id = i["id"]
        current_project.title = i["title"]
        current_project.description = i["description"]
        current_project.github = i["github"]
        current_project.web = i["web"]
        current_project.dropbox = i["dropbox"]
        current_project.bitbucket = i["bitbucket"]
        current_project.lab_id = i["lab_id"]
        # Add the lab of the project
        if i["lab_id"] is not None:
            for k in fablabs:
                if fablabs[k].id == i["lab_id"]:
                    current_project.lab = fablabs[k]
        else:
            current_project.lab = None
        current_project.owner_id = i["owner_id"]
        current_project.created_at = i["created_at"]
        current_project.updated_at = i["updated_at"]
        current_project.vimeo = i["vimeo"]
        current_project.flickr = i["flickr"]
        current_project.youtube = i["youtube"]
        current_project.drive = i["drive"]
        current_project.twitter = i["twitter"]
        current_project.facebook = i["facebook"]
        current_project.googleplus = i["googleplus"]
        current_project.instagram = i["instagram"]
        current_project.status = i["status"]
        current_project.version = i["version"]
        current_project.faq = i["faq"]
        current_project.scope = i["scope"]
        current_project.community = i["community"]
        current_project.lookingfor = i["lookingfor"]
        current_project.cover = i["cover"]
        url = project_url + str(current_project.id)
        current_project.url = url
        # Add the project
        projects[current_project.id] = current_project

    # Return a dictiornary / json
    if format.lower() == "dict" or format.lower() == "json":
        output = {}
        for j in projects:
            project_dict = projects[j].__dict__
            # Convert the lab from a Fab Lab object to a dict
            if project_dict["lab"] is not None:
                project_dict["lab"] = project_dict["lab"].__dict__
            output[j] = project_dict
    # Return a geojson, only for projects linked to a lab
    elif format.lower() == "geojson" or format.lower() == "geo":
        projects_list = []
        for p in projects:
            if projects[p].lab_id is not None:
                single_project = projects[p].__dict__
                if projects[p].lab is not None:
                    single_project["lab"] = single_project["lab"].__dict__
                for l in fablabs:
                    single_lab = fablabs[l].__dict__
                    if single_lab["id"] == single_project["lab_id"]:
                        project_lab = Feature(
                            type="Feature",
                            geometry=Point((single_lab["latitude"],
                                            single_lab["longitude"])),
                            properties=single_project)
                        projects_list.append(project_lab)
                output = dumps(FeatureCollection(projects_list))
    # Return an object
    elif format.lower() == "object" or format.lower() == "obj":
        output = projects
    # Default: return an object
    else:
        output = projects
    # Return a proper json
    if format.lower() == "json":
        output = json.dumps(output)
    return output