code: def _perform_scan(args, plugins):
      
      old_baseline = _get_existing_baseline(args.import_filename)
      if old_baseline:
          plugins = initialize.merge_plugin_from_baseline(
              _get_plugin_from_baseline(old_baseline), args,
          )
  
      # Favors `--exclude-files` and `--exclude-lines` CLI arguments
      # over existing baseline's regexes (if given)
      if old_baseline:
          if not args.exclude_files:
              args.exclude_files = _get_exclude_files(old_baseline)
  
          if (
              not args.exclude_lines
              and old_baseline.get('exclude')
          ):
              args.exclude_lines = old_baseline['exclude']['lines']
  
      # If we have knowledge of an existing baseline file, we should use
      # that knowledge and add it to our exclude_files regex.
      if args.import_filename:
          _add_baseline_to_exclude_files(args)
  
      new_baseline = baseline.initialize(
          plugins=plugins,
          exclude_files_regex=args.exclude_files,
          exclude_lines_regex=args.exclude_lines,
          path=args.path,
          scan_all_files=args.all_files,
      ).format_for_baseline_output()
  
      if old_baseline:
          new_baseline = baseline.merge_baseline(
              old_baseline,
              new_baseline,
          )
  
      return new_baseline
docs: :param args: output of `argparse.ArgumentParser.parse_args`
      :param plugins: tuple of initialized plugins
  
      :rtype: dict