code: def pairwise(args):
      
      from itertools import combinations
  
      p = OptionParser(pairwise.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      idsfile, = args
      ids = SetFile(idsfile)
      ids = sorted(ids)
      fw = open(idsfile + ".pairs", "w")
      for a, b in combinations(ids, 2):
          print("\t".join((a, b)), file=fw)
      fw.close()
docs: %prog pairwise ids
  
      Convert a list of IDs into all pairs.