def _GetInstNic(index, cb):
  def fn(ctx, inst):
    """Call helper function with instance NIC.

    @type ctx: L{InstanceQueryData}
    @type inst: L{objects.Instance}
    @param inst: Instance object

    """
    try:
      nic = inst.nics[index]
    except IndexError:
      return _FS_UNAVAIL

    return cb(ctx, index, nic)

  return fn
Converts a function into a decorator that optionally accepts keyword
dataset/ETHPy150Open ganeti/ganeti/lib/query.py/_GetInstNic--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/ndb/utils.py/decorator