def _isbn_pairing(items):
NameWrapper = namedtuple("<STR_LIT>", ["<STR_LIT:name>", "<STR_LIT>"])<EOL>metas = [NameWrapper(_just_name(x.filename), x) for x in [x for x in items if isinstance(x, MetadataFile)]]<EOL>ebooks = [NameWrapper(_just_name(x.filename), x) for x in [x for x in items if isinstance(x, EbookFile)]]<EOL>metas = sorted(metas, key=lambda x: x.name)<EOL>ebooks = sorted(ebooks, key=lambda x: x.name, reverse=True)<EOL>while metas:<EOL><INDENT>meta = metas.pop()<EOL>if not isbn_validator.is_valid_isbn(meta.name):<EOL><INDENT>continue<EOL><DEDENT>if not ebooks:<EOL><INDENT>break<EOL><DEDENT>ebook_index = _index(ebooks, meta.name, key=lambda x: x.name)<EOL>if ebook_index >= <NUM_LIT:0>:<EOL><INDENT>logger.debug(<EOL>"<STR_LIT>" % (<EOL>meta.obj.filename,<EOL>ebooks[ebook_index].obj.filename<EOL>)<EOL>)<EOL>items.append(<EOL>DataPair(<EOL>metadata_file=meta.obj,<EOL>ebook_file=ebooks[ebook_index].obj<EOL>)<EOL>)<EOL>items.remove(meta.obj)<EOL>items.remove(ebooks[ebook_index].obj)<EOL>ebooks = ebooks[ebook_index+<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>return items<EOL>
Pair `items` with same ISBN into `DataPair` objects.

Args:
    items (list): list of items, which will be searched.

Returns:
    list: list with paired items. Paired items are removed, `DataPair` is \
          added instead.