import six


def calc_pct(value, bounds, is_float):
    """
    Helper function to calculate a scaling tuple value from a percentage.
    """
    if isinstance(value, six.string_types):
        value = float(value[:-1]) * (bounds[1] - bounds[0]) / 100.0 + bounds[0]
    return value if is_float else int(value)