def add_scheduling_block(config):
    """Adds a scheduling block to the database, returning a response object"""
    try:
        DB.add_sbi(config)
    except jsonschema.ValidationError as error:
        error_dict = error.__dict__
        for key in error_dict:
            error_dict[key] = error_dict[key].__str__()
        error_response = dict(message="Failed to add scheduling block",
                              reason="JSON validation error",
                              details=error_dict)
        return error_response, HTTPStatus.BAD_REQUEST
    response = dict(config=config,
                    message='Successfully registered scheduling block '
                            'instance with ID: {}'.format(config['id']))
    response['links'] = {
        'self': '{}scheduling-block/{}'.format(request.url_root,
                                               config['id']),
        'list': '{}'.format(request.url),
        'home': '{}'.format(request.url_root)
    }
    return response, HTTPStatus.ACCEPTED
Adds a scheduling block to the database, returning a response object