Only N of transaction type X may be included in a block. The first
    argument must be interpretable as an integer. The second argument is
    interpreted as the name of a transaction family. For example, the
    string "NofX:2,intkey" means only allow 2 intkey transactions per
    block.

def _do_nofx(transactions, arguments):
    """
    Only N of transaction type X may be included in a block. The first
    argument must be interpretable as an integer. The second argument is
    interpreted as the name of a transaction family. For example, the
    string "NofX:2,intkey" means only allow 2 intkey transactions per
    block.
    """
    try:
        num, family = arguments.split(',')
        limit = int(num.strip())
    except ValueError:
        LOGGER.warning("Ignore, NofX requires arguments in the format "
                       "int,family not %s", arguments)
        return True
    count = 0
    family = family.strip()
    for txn in transactions:
        header = TransactionHeader()
        header.ParseFromString(txn.header)
        if header.family_name == family:
            count += 1

        if count > limit:
            LOGGER.debug("Too many transactions of type %s", family)
            return False

    return True