code: def pick_best_coinc(cls, coinc_results):
          
          mstat = 0
          mifar = 0
          mresult = None
  
          # record the trials factor from the possible coincs we could
          # maximize over
          trials = 0
          for result in coinc_results:
              # Check that a coinc was possible. See the 'add_singles' method
              # to see where this flag was added into the results dict
              if 'coinc_possible' in result:
                  trials += 1
  
                  # Check that a coinc exists
                  if 'foreground/ifar' in result:
                      ifar = result['foreground/ifar']
                      stat = result['foreground/stat']
                      if ifar > mifar or (ifar == mifar and stat > mstat):
                          mifar = ifar
                          mstat = stat
                          mresult = result
  
          # apply trials factor for the best coinc
          if mresult:
              mresult['foreground/ifar'] = mifar / float(trials)
              logging.info('Found %s coinc with ifar %s',
                           mresult['foreground/type'],
                           mresult['foreground/ifar'])
              return mresult
          # If no coinc, just return one of the results dictionaries. They will
          # all contain the same results (i.e. single triggers) in this case.
          else:
              return coinc_results[0]
docs: Choose the best two-ifo coinc by ifar first, then statistic if needed.
  
          This function picks which of the available double-ifo coincs to use.
          It chooses the best (highest) ifar. The ranking statistic is used as
          a tie-breaker.
          A trials factor is applied if multiple types of coincs are possible
          at this time given the active ifos.
  
          Parameters
          ----------
          coinc_results: list of coinc result dicts
              Dictionary by detector pair of coinc result dicts.
  
          Returns
          -------
          best: coinc results dict
              If there is a coinc, this will contain the 'best' one. Otherwise
              it will return the provided dict.