Creates a ModuleDefinition instance from the dictionary <d> from
        a mirte-file for the Manager instance <man>.

def module_definition_from_mirteFile_dict(man, d):
    """ Creates a ModuleDefinition instance from the dictionary <d> from
        a mirte-file for the Manager instance <man>. """
    m = ModuleDefinition()
    if 'inherits' not in d:
        d['inherits'] = list()
    if 'settings' not in d:
        d['settings'] = dict()
    if 'implementedBy' in d:
        m.implementedBy = d['implementedBy']
    m.inherits = set(d['inherits'])
    for p in d['inherits']:
        if p not in man.modules:
            raise ValueError("No such module %s" % p)
        m.deps.update(man.modules[p].deps)
        m.vsettings.update(man.modules[p].vsettings)
        m.inherits.update(man.modules[p].inherits)
        m.run = m.run or man.modules[p].run
    if 'run' in d:
        m.run = d['run']
    if len(m.inherits) == 0:
        m.inherits = set(['module'])
    for k, v in six.iteritems(d['settings']):
        if 'type' not in v:
            if k not in m.vsettings:
                raise ValueError("No such existing vsetting %s" % k)
            if 'default' in v:
                m.vsettings[k] = copy.copy(m.vsettings[k])
                m.vsettings[k].default = v['default']
            continue
        if v['type'] in man.modules:
            m.deps[k] = DepDefinition(v['type'], v.get('allownull', False))
        elif v['type'] in man.valueTypes:
            m.vsettings[k] = VSettingDefinition(
                v['type'],
                (man.valueTypes[v['type']](v['default'])
                 if 'default' in v else None)
            )
        else:
            raise ValueError("No such module or valuetype %s" % v)
    return m