def read(cls, data):
        """Reads data from URL or OrderedDict.
        Args:
            data: can be a URL pointing to a JSONstat file, a JSON string
                  or an OrderedDict.

        Returns:
            An object of class Collection populated with data.

        """
        if isinstance(data, OrderedDict):
            return cls(data)
        elif isinstance(data, basestring)\
             and data.startswith(("http://", "https://", "ftp://", "ftps://")):
            return cls(request(data))
        elif isinstance(data, basestring):
            try:
                json_dict = json.loads(data, object_pairs_hook=OrderedDict)
                return cls(json_dict)
            except ValueError:
                raise
        else:
            try:
                json_dict = json.load(data, object_pairs_hook=OrderedDict)
                return cls(json_dict)
            except ValueError:
                raise
def read ( cls , data ) : if isinstance ( data , OrderedDict ) : return cls ( data ) elif isinstance ( data , basestring ) and data . startswith ( ( "http://" , "https://" , "ftp://" , "ftps://" ) ) : return cls ( request ( data ) ) elif isinstance ( data , basestring ) : try : json_dict = json . loads ( data , object_pairs_hook = OrderedDict ) return cls ( json_dict ) except ValueError : raise else : try : json_dict = json . load ( data , object_pairs_hook = OrderedDict ) return cls ( json_dict ) except ValueError : raise
Reads data from URL or OrderedDict.
        Args:
            data: can be a URL pointing to a JSONstat file, a JSON string
                  or an OrderedDict.

        Returns:
            An object of class Collection populated with data.