Calculate the price of a name (without its namespace ID), given the
    namespace parameters.

    The minimum price is NAME_COST_UNIT (or NAME_COST_UNIT_STACKS)

    This method returns an integer in the *current* epoch,
    but it will return a float in previous epochs for backwards
    compatibility.  The units are determined by the given namespace.

def price_name(name, namespace, block_height):
    """
    Calculate the price of a name (without its namespace ID), given the
    namespace parameters.

    The minimum price is NAME_COST_UNIT (or NAME_COST_UNIT_STACKS)

    This method returns an integer in the *current* epoch,
    but it will return a float in previous epochs for backwards
    compatibility.  The units are determined by the given namespace.
    """
    units = None
    cost_unit = None
    epoch_features = get_epoch_features(block_height)

    if namespace['version'] == NAMESPACE_VERSION_PAY_WITH_STACKS:
        units = 'STACKS'
        cost_unit = NAME_COST_UNIT_STACKS
    else:
        units = 'BTC'
        cost_unit = NAME_COST_UNIT
    
    base = namespace['base']
    coeff = namespace['coeff']
    buckets = namespace['buckets']

    bucket_exponent = 0
    discount = 1.0

    if len(name) < len(buckets):
        bucket_exponent = buckets[len(name)-1]
    else:
        bucket_exponent = buckets[-1]

    # no vowel discount?
    if sum( [name.lower().count(v) for v in ["a", "e", "i", "o", "u", "y"]] ) == 0:
        # no vowels!
        discount = max( discount, namespace['no_vowel_discount'] )

    # non-alpha discount?
    if sum( [name.lower().count(v) for v in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "_"]] ) > 0:
        # non-alpha!
        discount = max( discount, namespace['nonalpha_discount'] )

    price = None
    final_price = None

    if EPOCH_FEATURE_INT_DIVISION in epoch_features:
        # post-Stacks, we can have arbitrarily high prices and valuations.  Use integer division
        price = long(coeff * (base ** bucket_exponent) * cost_unit) / int(discount)

        if price < cost_unit:
            price = long(cost_unit)

        # we're using price divisors in this epoch 
        price_divisor = get_epoch_price_divisor(block_height, namespace['namespace_id'], units)
        final_price = price / price_divisor

        assert isinstance(final_price, (int,long))

    else:
        # pre-Stacks, this was float, since it was deemed "safe" for the size of the numbers we were using.
        # (wish we knew better then)
        price = (float(coeff * (base ** bucket_exponent)) / float(discount)) * cost_unit
        
        if price < cost_unit:
            price = cost_unit

        # in this epoch, the price_multiplier is a float coefficient
        price_multiplier = get_epoch_price_multiplier(block_height, namespace['namespace_id'], units)
        final_price = price * price_multiplier

    return final_price