def __init__(self, jsonstr=None, key=None, warnings=None):
super(Resource, self).__init__()<EOL>self.warnings = warnings<EOL>if jsonstr is not None:<EOL><INDENT>data = json.loads(json.dumps(jsonstr))<EOL>if key is not None:<EOL><INDENT>object.__setattr__(self, '<STR_LIT>', data[key])<EOL><DEDENT>else:<EOL><INDENT>object.__setattr__(self, '<STR_LIT>', data)<EOL><DEDENT><DEDENT>
Initialization of the object

        Args:
            jsonstr (str): a raw JSON string that is returned by a request.
                We store all the data in `self.json_data` and use `__getattr__`
                and `__setattr__` to make the data accessible like attributes
                of the object
            key (str): Optional key to use with jsonstr. If `key` exists, we'll
                load the data of `jsonstr[key]` instead of the whole `jsonstr`