_imm_resolve_deps(imm_class) resolves the dependencies of the given immutable class imm_class
    and edits the immutable metadata appropriately.

def _imm_resolve_deps(cls):
    '''
    _imm_resolve_deps(imm_class) resolves the dependencies of the given immutable class imm_class
    and edits the immutable metadata appropriately.
    '''
    dat = cls._pimms_immutable_data_
    params = dat['params']
    values = dat['values']
    consts = dat['consts']
    checks = dat['checks']
    members = list(params.keys()) + list(values.keys())
    mem_ids = {k:i for (i,k) in enumerate(members)}
    # make sure that every input that's not already a value or param becomes a param:
    all_inputs = [v[0] for v in six.itervalues(values)] + [c[0] for c in six.itervalues(checks)]
    all_inputs = set([i for inp in all_inputs for i in inp])
    extra_inputs = [i for i in all_inputs if i not in mem_ids]
    for i in extra_inputs:
        params[i] = (None, None, [], [], [])
        mem_ids[i] = len(members)
        members.append(i)
    # create a graph of the dependencies:
    dep_edges = set([])
    for (v,(inputs,_,_)) in six.iteritems(values):
        for i in inputs:
            dep_edges.add((mem_ids[v], mem_ids[i]))
    # get the transitive closure...
    deps = _imm_trans_clos(dep_edges)
    # we can put all the param and value deps into their appropriate places now
    for (dependant, dependency) in deps:
        if dependency is dependant:
            raise RuntimeError('circular dependency in immutable: value \'%s\'' % dependant)
        (mdpcy, mdpdt) = (members[dependency], members[dependant])
        if mdpcy in params:
            params[mdpcy][4].append(mdpdt)
        elif mdpcy in values:
            values[mdpcy][2].append(mdpdt)
    # last major task is to setup the checks
    deps2params = {v: set([]) for v in six.iterkeys(values)}
    for (p,pd) in six.iteritems(params):
        for v in pd[4]:
            deps2params[v].add(p)
    deps2consts = {v: set([]) for v in six.iterkeys(values)}
    for c in six.iterkeys(consts):
        deps = values[c][2]
        for v in deps:
            deps2consts[v].add(c)
    for (c,(arg_list,check_fn)) in six.iteritems(checks):
        param_list = set([])
        const_list = set([])
        for a in arg_list:
            if a in params: param_list.add(a)
            elif a in values:
                if a in consts: const_list.add(a)
                else:
                    param_list |= deps2params[a]
                    const_list |= deps2consts[a]
            else:
                raise RuntimeError('requirement %s requested non-member: %s' % (c, a))
        for p in param_list:
            params[p][2].append(arg_list)
            params[p][3].append(check_fn)
        for c in const_list:
            consts[p][0].append(arg_list)
            consts[p][1].append(check_fn)
    # That's it; all data should be built at this point
    return cls