import importlib


def getModelDesc(model=None):
    """Returns a brief description of the selected model.
    
    Parameters
    ----------
    model   : str   
              Name of the model to get the description of

    Returns
    -------
    A string with the description of the model
    """

    if model is None:
        raise ValueError('Unknown model. No model name is given.')

    try:
        mdl = importlib.import_module(model)
    except ImportError:
        try:
            mdl = importlib.import_module('radmc3dPy.models.'+model)
        except ImportError:
            msg = model+'.py could not be imported. The model files should either be in the '\
                  + ' current working directory or in the radmc3d python module directory'
            raise ImportError(msg)

    if callable(getattr(mdl, 'getModelDesc')):
        return mdl.getModelDesc()
    else:
        raise RuntimeError(model+'.py does not contain a getModelDesc() function.')