@classmethod
    def fromapi(cls, attrib):
        """
        Constructs a photo object from the Flickr API XML specification.
        """
        if "url_o" in attrib:
            url = attrib["url_o"] 
            size = attrib["width_o"], attrib["height_o"]
            format = "original"
        elif "url_l" in attrib:
            url = attrib["url_l"]
            size = attrib["width_l"], attrib["height_l"]
            format = "large"
        elif "url_m" in attrib:
            url = attrib["url_m"]
            size = attrib["width_m"], attrib["height_m"]
            format = "medium"
        elif "url_s" in attrib:
            url = attrib["url_s"]
            size = attrib["width_s"], attrib["height_s"]
            format = "small"
        else:
            raise RuntimeError("Photo does not have URL")

        return Photo(None, url, size, format, attrib["id"])
dataset/ETHPy150Open cvondrick/pyvision/vision/flickr.py/Photo.fromapi/original