<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transitive_hydrated_targets(build_file_addresses):
 """Given BuildFileAddresses, kicks off recursion on expansion of TransitiveHydratedTargets. The TransitiveHydratedTarget struct represents a structure-shared graph, which we walk and flatten here. The engine memoizes the computation of TransitiveHydratedTarget, so when multiple TransitiveHydratedTargets objects are being constructed for multiple roots, their structure will be shared. """


  transitive_hydrated_targets = yield [Get(TransitiveHydratedTarget, Address, a)
                                       for a in build_file_addresses.addresses]

  closure = OrderedSet()
  to_visit = deque(transitive_hydrated_targets)

  while to_visit:
    tht = to_visit.popleft()
    if tht.root in closure:
      continue
    closure.add(tht.root)
    to_visit.extend(tht.dependencies)

  yield TransitiveHydratedTargets(tuple(tht.root for tht in transitive_hydrated_targets), closure)