def assign_pairs(seqs, name='<STR_LIT>', delim=None, delim_occurance=<NUM_LIT:1>, pairs_only=False,<EOL>h_selection_func=None, l_selection_func=None):
pdict = {}<EOL>for s in seqs:<EOL><INDENT>if delim is not None:<EOL><INDENT>pname = delim.join(s[name].split(delim)[:delim_occurance])<EOL><DEDENT>else:<EOL><INDENT>pname = s[name]<EOL><DEDENT>if pname not in pdict:<EOL><INDENT>pdict[pname] = [s, ]<EOL><DEDENT>else:<EOL><INDENT>pdict[pname].append(s)<EOL><DEDENT><DEDENT>pairs = [Pair(pdict[n], name=n,<EOL>h_selection_func=h_selection_func,<EOL>l_selection_func=l_selection_func) for n in pdict.keys()]<EOL>if pairs_only:<EOL><INDENT>pairs = [p for p in pairs if p.is_pair]<EOL><DEDENT>return pairs<EOL>
Assigns sequences to the appropriate mAb pair, based on the sequence name.

Inputs:

::seqs:: is a list of dicts, of the format returned by querying a MongoDB containing
    Abstar output.
::name:: is the dict key of the field to be used to group the sequences into pairs.
    Default is 'seq_id'
::delim:: is an optional delimiter used to truncate the contents of the ::name:: field.
    Default is None, which results in no name truncation.
::delim_occurance:: is the occurance of the delimiter at which to trim. Trimming is performed
    as delim.join(name.split(delim)[:delim_occurance]), so setting delim_occurance to -1 will
    trucate after the last occurance of delim. Default is 1.
::pairs_only:: setting to True results in only truly paired sequences (pair.is_pair == True)
    will be returned. Default is False.

Returns a list of Pair objects, one for each mAb pair.