import importlib


def _import_class(cls, minv=None):
    """Take a string FQP and return the imported class or identifier
    clas is of the form "package.module.klass" or "package.module:subobject.klass"
    """
    if ":" in cls:
      mod, name = cls.rsplit(":", 1)
      mod = importlib.import_module(mod)
      for part in name.split("."):
        mod = getattr(mod, part)
      return mod
    else:
      mod, name = cls.rsplit(".", 1)
      mod = importlib.import_module(mod)
      return getattr(mod, name)