code: def dependencies_order_of_build(target_contract, dependencies_map):
      
      if not dependencies_map:
          return [target_contract]
  
      if target_contract not in dependencies_map:
          raise ValueError('no dependencies defined for {}'.format(target_contract))
  
      order = [target_contract]
      todo = list(dependencies_map[target_contract])
  
      while todo:
          target_contract = todo.pop(0)
          target_pos = len(order)
  
          for dependency in dependencies_map[target_contract]:
              # we need to add the current contract before all its depedencies
              if dependency in order:
                  target_pos = order.index(dependency)
              else:
                  todo.append(dependency)
  
          order.insert(target_pos, target_contract)
  
      order.reverse()
      return order
docs: Return an ordered list of contracts that is sufficient to successfully
      deploy the target contract.
  
      Note:
          This function assumes that the `dependencies_map` is an acyclic graph.