from enum import Enum


def dict_to_enum(name, cfg_data):
  """Dynamically create ModelZoo enum type using model zoo YAML
  :param name: (str) name of enum
  :param cfg_data: (dict)
  :returns (Enum)
  """
  enum_data = {kv[0].upper(): i for i, kv in enumerate(cfg_data.items())}
  return Enum(name, enum_data)