def _clean_tablename(db, name, database='default'):
  try:
    table = db.get_table(database, name)
    if table.name:
      raise forms.ValidationError(_('Table "%(name)s" already exists.') % {'name': name})
  except Exception:
    return name
dataset/ETHPy150Open cloudera/hue/apps/beeswax/src/beeswax/forms.py/_clean_tablename/original