def get_caption(prop, dic):
    """ Get a textual caption of a keras property that my be $
        - a literal string label (e.g. 'mse')
        - an instance of a class
        - a reference to a function
    """
    if prop is not None:
        if isinstance(prop, str):
            prop_extract = prop.lower().replace('_', '')
            if prop_extract in dic:
                return dic[prop_extract]
            else:
                return prop
        else:
            prop_extract = type(prop).__name__.lower()
            if prop_extract == 'function':
                prop_extract = prop.__name__.lower().replace('_', '')
                if prop_extract in dic:
                    return dic[prop_extract]
                else:
                    return prop.__name__
            elif prop_extract in dic:
                return dic[prop_extract]
            else:
                return type(prop).__name__