import click


def allow_two_molecules(ctx, param, value):
    """click callback to require that --mol is specified exactly twice"""
    if len(value) != 2:
        raise click.BadParameter("Must specify --mol exactly twice.")
    return value