parameters: (sort,subs)
return_statement: return sort
docstring: Substitute sorts for sorts in a sort.
docstring_summary: Substitute sorts for sorts in a sort.
docstring_tokens: Substitute sorts for sorts in a sort .
function: def resort_sort(sort,subs):
      """
      Substitute sorts for sorts in a sort.
      """
      if isinstance(sort,UnionSort):
          res = UnionSort()
          res.sorts = [resort_sort(s,subs) for s in sort.sorts]
          return res
      if sort in subs:
          return subs[sort]
      if isinstance(sort,FunctionSort):
          return FunctionSort(*[resort_sort(s,subs) for s in (sort.dom+(sort.rng,))])
      return sort
function_tokens: def resort_sort ( sort , subs ) : if isinstance ( sort , UnionSort ) : res = UnionSort ( ) res . sorts = [ resort_sort ( s , subs ) for s in sort . sorts ] return res if sort in subs : return subs [ sort ] if isinstance ( sort , FunctionSort ) : return FunctionSort ( * [ resort_sort ( s , subs ) for s in ( sort . dom + ( sort . rng , ) ) ] ) return sort