def real_value(value, base):
  """
  Returns int(value) if it isn't a percentage, or applies it over base

  @param value The value or percentage
  @param base  The maximum value if value is a percentage
  """
  try:
    if not value.endswith('%'):
      return int(value)
    else:
      value = float(value[:-1])
      return int((value / 100) * base)
  except ValueError:
    raise ValueError("Invalid values")