code: def _generate_index(self, paper):
          
          if self.index_by is None or not hasattr(paper, self.index_by):
              if not hasattr(paper, 'hashIndex'): # Generate a new index for this paper.
                  m = hashlib.md5()
  
                  # If we dont have author name then we just use the title of the paper
                  # to generate unique identifier.
                  if paper.authors is None:
                      hashable = paper.title
                  else:
                      if hasattr(paper, 'title'):
                          title = paper.title
                      else:
                          title = ''
                      if len(paper.authors) == 0:
                          hashable = title
                      else:
                          authors = list(zip(*paper.authors))[0]
                          hashable = u' '.join(list([title] + [l + f for l, f in authors]))
  
                  m.update(hashable.encode('utf-8'))
                  setattr(paper, 'hashIndex', m.hexdigest())
              return getattr(paper, 'hashIndex')
          identifier = getattr(paper, self.index_by)
          if type(identifier) is list:
              identifier = identifier[0]
          if self.index_by == 'link':
              _, identifier = os.path.split(identifier)
          return identifier
docs: If the ``index_by`` field is not set or not available, generate a unique
          identifier using the :class:`.Paper`\'s title and author names.