'Since __len__ is called quite frequently (for example, as part of
list(qs)), we populate the result cache and cache the length.'

def __len__(self):

    if (self._len is not None):
        return self._len
    if self._has_more:
        list(self._iter_results())
    self._len = len(self._result_cache)
    return self._len
