<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def deduplicate( ctx, strategy, time_source, regexp, dry_run, message_id, size_threshold, content_threshold, show_diff, maildirs):
 """ Deduplicate mails from a set of maildir folders. Run a first pass computing the canonical hash of each encountered mail from their headers, then a second pass to apply the deletion strategy on each subset of duplicate mails. \b Removal strategies for each subsets of duplicate mails: - delete-older: Deletes the olders, keeps the newests. - delete-oldest: Deletes the oldests, keeps the newers. - delete-newer: Deletes the newers, keeps the oldests. - delete-newest: Deletes the newests, keeps the olders. - delete-smaller: Deletes the smallers, keeps the biggests. - delete-smallest: Deletes the smallests, keeps the biggers. - delete-bigger: Deletes the biggers, keeps the smallests. - delete-biggest: Deletes the biggests, keeps the smallers. - delete-matching-path: Deletes all duplicates whose file path match the regular expression provided via the --regexp parameter. - delete-non-matching-path: Deletes all duplicates whose file path doesn't match the regular expression provided via the --regexp parameter. Deletion strategy on a duplicate set only applies if no major differences between mails are uncovered during a fine-grained check differences during the second pass. Limits can be set via the threshold options. """

    # Print help screen and exit if no maildir folder provided.
    if not maildirs:
        click.echo(ctx.get_help())
        ctx.exit()

    # Validate exclusive options requirement depending on strategy.
    requirements = [
        (time_source, '-t/--time-source', [
            DELETE_OLDER, DELETE_OLDEST, DELETE_NEWER, DELETE_NEWEST]),
        (regexp, '-r/--regexp', [
            DELETE_MATCHING_PATH, DELETE_NON_MATCHING_PATH])]
    for param_value, param_name, required_strategies in requirements:
        if strategy in required_strategies:
            if not param_value:
                raise click.BadParameter(
                    '{} strategy requires the {} parameter.'.format(
                        strategy, param_name))
        elif param_value:
            raise click.BadParameter(
                '{} parameter not allowed in {} strategy.'.format(
                    param_name, strategy))

    conf = Config(
        strategy=strategy,
        time_source=time_source,
        regexp=regexp,
        dry_run=dry_run,
        show_diff=show_diff,
        message_id=message_id,
        size_threshold=size_threshold,
        content_threshold=content_threshold,
        # progress=progress,
    )

    dedup = Deduplicate(conf)

    logger.info('=== Start phase #1: load mails and compute hashes.')
    for maildir in maildirs:
        dedup.add_maildir(maildir)

    logger.info('=== Start phase #2: deduplicate mails.')
    dedup.run()

    dedup.report()