docs: function wrap(func) {
          if (typeof func !== 'function') {
              throw new Error('function argument is expected');
          }
  
          if (func.tasync_wraped === undefined) {
              func.tasync_wraped = function () {
                  var args = arguments;
                  var future = new Future();
  
                  args[args.length++] = function (error, value) {
                      if (error) {
                          future.reject(error instanceof Error ? error : new Error(error));
                      } else {
                          future.resolve(value);
                      }
                  };
  
                  func.apply(this, args);
  
                  if (future.state === STATE_LISTEN) {
                      return future;
                  } else if (future.state === STATE_RESOLVED) {
                      return future.value;
                  } else {
                      assert(future.state === STATE_REJECTED);
                      throw future.value;
                  }
              };
  
              func.tasync_wraped.tasync_unwraped = func;
          }
  
          return func.tasync_wraped;
      }