def validate(data, schema_file='nailgun'):
    """Validates a given partition scheme using jsonschema.

    :param scheme: partition scheme to validate
    """
    base_path = os.path.dirname(__file__)
    schemas_path = os.path.join(base_path, 'json_schemes')
    with open(os.path.join(schemas_path, schema_file % '%s.json')) as file:
        schema = json.load(file)

    try:
        checker = jsonschema.FormatChecker()
        jsonschema.validate(data, schema,
                            format_checker=checker)
    except Exception as exc:
        LOG.exception(exc)
        raise errors.WrongPartitionSchemeError(str(exc))

    # scheme is not valid if the number of disks is 0
    if not [d for d in data if d['type'] == 'disk']:
        raise errors.WrongPartitionSchemeError(
            'Partition scheme seems empty')

    # TODO(lobur): Must be done after unit conversion
    # for space in data:
    #     for volume in space.get('volumes', []):
    #         if volume['size'] > 16777216 and volume.get('mount') == '/':
    #             raise errors.WrongPartitionSchemeError(
    #                 'Root file system must be less than 16T')

    # TODO(kozhukalov): need to have additional logical verifications
    # maybe sizes and format of string values
dataset/ETHPy150Open openstack/bareon/bareon/drivers/data/ks_spaces_validator.py/validate/swapped operands of `%`