code: def construct_reference_system(
      symbols,
      candidates=None,
      options=None,
  ):
      if hasattr(options, 'no_hydrogen') and options.no_hydrogen:
          add_hydrogen = False
      else:
          add_hydrogen = True
      references = {}
      sorted_candidates = [
          'H2',
          'H2O',
          'NH3',
          'N2',
          'CH4',
          'CO',
          'H2S',
          'HCl',
          'O2']
      if candidates is None:
          candidates = sorted_candidates
      else:
          odd_candidates = [c for c in candidates if c not in sorted_candidates]
          candidates = [c for c in sorted_candidates if c in candidates] \
              + odd_candidates
      added_symbols = []
      for symbol in symbols:
          added_symbols.append(symbol)
          for candidate in candidates:
              _symbols = ase.symbols.string2symbols(candidate)
              if set(added_symbols) <= set(list(references.keys()) + _symbols) \
                      and set(list(references.keys()) + _symbols) <= set(symbols) \
                      and candidate not in references.values():
                  references[symbol] = candidate
                  break
          else:
              raise UserWarning((
                  "No candidate satisfied {symbol}. Add more candidates\n"
                  "    Symbols {symbols}\n"
                  "    _Symbols {_symbols}\n"
                  "    References {references}\n"
                  "    Candidates {candidates}\n"
              ).format(
                  symbol=symbol,
                  symbols=symbols,
                  _symbols=_symbols,
                  candidates=candidates,
                  references=list(references.keys()),
              ))
      sorted_references = []
      references = list(references.items())
      return references