def assert_consistent_regions(from_spec, from_command_line, builder_exception):
    """
    Verifies the regions passed with --region CLI argument and the ones
    specified in regionalOptions are the same (if both CLI and spec were used)
    """
    if from_spec is None or from_command_line is None:
        return
    if set(from_spec) != set(from_command_line):
        raise builder_exception("--region and the 'regionalOptions' key in the JSON file do not agree")