code: def cleanupFilename(self, name):
          
  
          context = self.context
          id = ''
          name = name.replace('\\', '/')  # Fixup Windows filenames
          name = name.split('/')[-1]  # Throw away any path part.
          for c in name:
              if c.isalnum() or c in '._':
                  id += c
  
          # Raise condition here, but not a lot we can do about that
          if context.check_id(id) is None and getattr(context, id, None) is None:
              return id
  
          # Now make the id unique
          count = 1
          while 1:
              if count == 1:
                  sc = ''
              else:
                  sc = str(count)
              newid = "copy{0:s}_of_{1:s}".format(sc, id)
              if context.check_id(newid) is None \
                      and getattr(context, newid, None) is None:
                  return newid
              count += 1
docs: Generate a unique id which doesn't match the system generated ids