docs: def assign_pairs(seqs, name='seq_id', delim=None, delim_occurance=1, pairs_only=False,
                   h_selection_func=None, l_selection_func=None):
      '''
      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.
      '''
      pdict = {}
      for s in seqs:
          if delim is not None:
              pname = delim.join(s[name].split(delim)[:delim_occurance])
          else:
              pname = s[name]
          if pname not in pdict:
              pdict[pname] = [s, ]
          else:
              pdict[pname].append(s)
      pairs = [Pair(pdict[n], name=n,
                    h_selection_func=h_selection_func,
                    l_selection_func=l_selection_func) for n in pdict.keys()]
      if pairs_only:
          pairs = [p for p in pairs if p.is_pair]
      return pairs