def _get_foreignkeys_for_fields(self, *args):

        for field_name in args:
            model = self._meta.get_field(field_name).rel.to
            try:
                id = int(self._response.pop(field_name + '_id', None))
                setattr(self, field_name, model.objects.get(pk=id))
            except model.DoesNotExist:
                try:
                    self._foreignkeys_pre_save += [(field_name, model.remote.get(id))]
                except tweepy.TweepError:
                    pass
            except TypeError:
                pass
dataset/ETHPy150Open ramusus/django-twitter-api/twitter_api/models.py/TwitterModel._get_foreignkeys_for_fields/original