def convert_names_to_highlevel(names, low_level_names,
                               high_level_names):
  """
  Converts group names from a low level to high level API

  This is useful for example when you want to return ``db.groups()`` for
  the :py:mod:`bob.bio.base`. Your instance of the database should
  already have ``low_level_names`` and ``high_level_names`` initialized.

  """

  if names is None:
    return None
  mapping = dict(zip(low_level_names, high_level_names))
  if isinstance(names, str):
    return mapping.get(names)
  return [mapping[g] for g in names]