def _set_object_or_id(self, field, object_):
        id_field = '%s_id' % field
        if isinstance(object_, six.integer_types):
            setattr(self, id_field, object_)
        elif object_ is None:
            setattr(self, field, None)
            setattr(self, id_field, None)
        else:
            setattr(self, field, object_)
            setattr(self, id_field, object_.id)
Data downloaded from Google trends for given query terms. Warning, if you use this function multiple times in a row you get blocked due to terms of service violations. The function will cache the result of your query, if you wish to refresh an old query set refresh_data to True. The function is inspired by this notebook: http://nbviewer.ipython.org/github/sahuguet/notebooks/blob/master/GoogleTrends%20meet%20Notebook.ipynb
dataset/ETHPy150Open tschellenbach/Stream-Framework/stream_framework/activity.py/Activity._set_object_or_id--crossover with--dataset/ETHPy150Open SheffieldML/GPy/GPy/util/datasets.py/google_trends