code: def transform_future(transformation, future):
      
      new_future = tornado_Future()
      def _transform(f):
          assert f is future
          if f.exc_info() is not None:
              new_future.set_exc_info(f.exc_info())
          else:
              try:
                  new_future.set_result(transformation(f.result()))
              except Exception:
                  # An exception here idicates that the transformation was unsuccesful
                  new_future.set_exc_info(sys.exc_info())
  
      future.add_done_callback(_transform)
      return new_future
docs: Returns a new future that will resolve with a transformed value
  
      Takes the resolution value of `future` and applies transformation(*future.result())
      to it before setting the result of the new future with the transformed value. If
      future() resolves with an exception, it is passed through to the new future.
  
      Assumes `future` is a tornado Future.