def check_custom_concurrency(default, forced, logger=None):
    """ Get the proper concurrency value according to the default one
    and the one specified by the crawler.

    :param int default:
      default tasks concurrency

    :param forced:
      concurrency asked by crawler

    :return:
      concurrency to use.
    :rtype: int
    """
    logger = logger or LOGGER
    cmc_msg = 'Invalid "max_concurrent_tasks: '
    if not isinstance(forced, int):
        logger.warn(cmc_msg + 'expecting int')
    elif forced > default:
        msg = 'may not be greater than: %s' % default
        logger.warn(cmc_msg + msg)
    elif forced < 1:
        msg = 'may not be less than 1'
        logger.warn(cmc_msg + msg)
    else:
        default = forced
    return default
Get the proper concurrency value according to the default one
    and the one specified by the crawler.

    :param int default:
      default tasks concurrency

    :param forced:
      concurrency asked by crawler

    :return:
      concurrency to use.
    :rtype: int