def validate_filters_or_records(filters_or_records):
    """Validation for filters_or_records variable from bulk_modify and bulk_delete"""
    # If filters_or_records is empty, fail
    if not filters_or_records:
        raise ValueError('Must provide at least one filter tuples or Records')
    # If filters_or_records is not list of Record or tuple, fail
    if not isinstance(filters_or_records[0], (Record, tuple)):
        raise ValueError('Cannot provide both filter tuples and Records')
    # If filters_or_records is not list of either Record or only tuple, fail
    _type = type(filters_or_records[0])
    for item in filters_or_records:
        if not isinstance(item, _type):
            raise ValueError("Expected filter tuple or Record, received {0}".format(item))

    return _type
def validate_filters_or_records ( filters_or_records ) : if not filters_or_records : raise ValueError ( 'Must provide at least one filter tuples or Records' ) if not isinstance ( filters_or_records [ 0 ] , ( Record , tuple ) ) : raise ValueError ( 'Cannot provide both filter tuples and Records' ) _type = type ( filters_or_records [ 0 ] ) for item in filters_or_records : if not isinstance ( item , _type ) : raise ValueError ( "Expected filter tuple or Record, received {0}" . format ( item ) ) return _type
Validation for filters_or_records variable from bulk_modify and bulk_delete