code: def run(self):
          request_cache = cache.get_request_cache()
          session = client.get_client().create_session()
          self.mark_incomplete()
          universes = []
          with session.no_autoflush:
              movies = session.query(models.Movie).all()
              for movie in movies:
                  article = request_cache.get("http://marvel.wikia.com" + movie.url,
                                              xpath="//article[@id='WikiaMainContent']",
                                              rate_limit=0.5)
                  doc = html.fromstring(article)
                  node = doc.xpath("//span[@id='Appearances']")[0]
                  node = node.getparent()
                  appearance_type = "Featured Characters"
                  node = node.getnext()
                  while node is not None and node.tag != 'h2':
                      if node.tag == 'ul' and ('characters' in appearance_type.lower() or
                                                       'villains' in appearance_type.lower()):
                          for li in node.iter('li'):
                              for a in li:
                                  if a.tag != 'a':
                                      continue
                                  if "image" in a.get("class", "") or not a.get("href").startswith("/wiki/"):
                                      continue
                                  match = re.search(r'\(.*?\)', a.get('href'))
                                  if match:
                                      universes.append(match.group()[1:-1])
                                  try:
                                      character = session.query(models.Character) \
                                          .filter(models.Character.url == a.get("href")) \
                                          .one()
                                      appearance = models.MovieAppearance(movie_id=movie.id,
                                                                          character_id=character.id,
                                                                          appearance_type=appearance_type)
                                      session.add(appearance)
                                  except NoResultFound:
                                      pass
                                  break
                      elif node.tag == 'p':
                          appearance_type = " ".join(node.itertext()).strip().strip(':').strip()
                      node = node.getnext()
          print("\nNumber of character appearances per universe: ")
          print(pd.Series(data=universes).value_counts())
          session.commit()
          session.close()
          self.mark_complete()