def METHOD_NAME(arg):
    """
    Dependency resolver
    "arg" is a dependency dictionary in which
    the values are the dependencies of their respective keys.
    Source: http://code.activestate.com/recipes/576570-dependency-resolver/
    Copyright: Louis RIVIERE
    Original license: MIT
    """
    d = dict((k, set(arg[k])) for k in arg)
    r = []
    while d:
        # values not in keys (items without dep)
        t = set(i for v in d.values() for i in v)-set(d.keys())
        # and keys without value (items without dep)
        t.update(k for k, v in d.items() if not v)
        # can be done right away
        r.append(t)
        # and cleaned up
        d = dict(((k, v-t) for k, v in d.items() if v))
    return [item for s in r for item in s]