Generate URL's for genre

def generate_urls_for_genre(self, genre_url):
    """
    Generate URL's for genre
    """
    letters = list(string.ascii_uppercase)
    urls = []
    for letter in letters:
      base = '{}&letter={}'.format(genre_url, letter)
      page = r.get(base)
      tree = html.fromstring(page.content)
      elements = tree.xpath("//ul[@class='list paginate']")
      if not elements:
        urls.append(base)
      else:
        for i in xrange(1, self._find_num_pages(base)):
          urls.append('{}&page={}#page'.format(base, i))
    return urls