code: def maybe_future(x):
      
      if is_future(x):
          return x
      else:
          fut = Future()
          fut.set_result(x)
          return fut
docs: Converts ``x`` into a `.Future`.
  
      If ``x`` is already a `.Future`, it is simply returned; otherwise
      it is wrapped in a new `.Future`.  This is suitable for use as
      ``result = yield gen.maybe_future(f())`` when you don't know whether
      ``f()`` returns a `.Future` or not.
  
      .. deprecated:: 4.3
         This function only handles ``Futures``, not other yieldable objects.
         Instead of `maybe_future`, check for the non-future result types
         you expect (often just ``None``), and ``yield`` anything unknown.