<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_scheduling_blocks(num_blocks, clear=True):
 """Add a number of scheduling blocks to the db."""

    db_client = ConfigDb()
    if clear:
        LOG.info('Resetting database ...')
        db_client.clear()
        start_sbi_id = 0
        start_pb_id = 0
    else:
        start_sbi_id = len(db_client.get_sched_block_instance_ids())
        start_pb_id = len(db_client.get_processing_block_ids())

    LOG.info("Adding %i SBIs to the db", num_blocks)
    for config in _scheduling_block_config(num_blocks, start_sbi_id,
                                           start_pb_id):
        LOG.info('Creating SBI %s with %i PBs.', config['id'],
                 len(config['processing_blocks']))
        db_client.add_sched_block_instance(config)