def with_decimal_places(number, decimal_count):
    """
    Trims a float to a given number of decimal places
    """
    # n is a placeholder for the number of decimals to keep
    return "{:.nf}" \
        .replace("n", str(decimal_count)) \
        .format(number)