code: def modules_get(url_tpl, per_page, css, max_modules=2000, pagination_type=PT.normal):
      
      page = 0
      elements = False
      done_so_far = 0
  
      max_potential_pages = max_modules / per_page
      print("Maximum pages: %s." % max_potential_pages)
  
      stop = False
      while elements == False or len(elements) == per_page:
          url = url_tpl % page
  
          r = requests.get(url)
          bs = BeautifulSoup(r.text, 'lxml')
          elements = bs.select(css)
  
          for element in elements:
              yield element
              done_so_far += 1
  
              if done_so_far >= max_modules:
                  stop = True
                  break
  
          if stop:
              break
  
          if pagination_type == PT.normal:
              print('Finished parsing page %s.' % page)
              page += 1
          elif pagination_type == PT.skip:
              print('Finished parsing page %s.' % (page / per_page))
              page += per_page
          else:
              assert False
docs: Gets a list of modules. Note that this function can also be used to get
      themes.
      @param url_tpl: a string such as
      https://drupal.org/project/project_module?page=%s. %s will be replaced with
      the page number.
      @param per_page: how many items there are per page.
      @param css: the elements matched by this selector will be returned by the
          iterator.
      @param max_modules: absolute maximum modules we will attempt to request.
      @param pagination_type: type of pagination. See the PaginationType enum
          for more information.
      @return: bs4.element.Tag
      @see: http://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors
      @see: http://www.crummy.com/software/BeautifulSoup/bs4/doc/#tag