code: def main(**kwargs):
      
      # For tests.
      _parse_args = kwargs.get('_parse_args', parse_args)
      _load_transactions = kwargs.get('_load_transactions', load_transactions)
      _apriori = kwargs.get('_apriori', apriori)
  
      args = _parse_args(sys.argv[1:])
      transactions = _load_transactions(
          chain(*args.input), delimiter=args.delimiter)
      result = _apriori(
          transactions,
          max_length=args.max_length,
          min_support=args.min_support,
          min_confidence=args.min_confidence)
      for record in result:
          args.output_func(record, args.output)
docs: Executes Apriori algorithm and print its result.