Python snippet to resolve dependencies in given script for generating working order.