code: def longest_unique_prefix(query, targets, remove_self=True):
      
      query = op.basename(query)
      targets = [op.basename(x) for x in targets]
      prefix_lengths = [len(op.commonprefix([query, name])) for name in targets]
      if remove_self and len(query) in prefix_lengths:
          prefix_lengths.remove(len(query))
      longest_length = max(prefix_lengths)
      return query[:longest_length + 1]
docs: Find the longest unique prefix for filename, when compared against a list of
      filenames. Useful to simplify file names in a pool of files. See usage in
      formats.fasta.pool().