def pool_attr_add(arg, opts, shell_opts):
    """ Add attributes to a pool
    """

    res = Pool.list({ 'name': arg })
    if len(res) < 1:
        print >> sys.stderr, "No pool with name '%s' found." % arg
        sys.exit(1)

    p = res[0]

    for avp in opts.get('extra-attribute', []):
        try:
            key, value = avp.split('=', 1)
        except __HOLE__:
            print >> sys.stderr, "ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp
            sys.exit(1)

        if key in p.avps:
            print >> sys.stderr, "Unable to add extra-attribute: '%s' already exists." % key
            sys.exit(1)

        p.avps[key] = value

    try:
        p.save()
    except NipapError as exc:
        print >> sys.stderr, "Could not save pool changes: %s" % str(exc)
        sys.exit(1)

    print "Pool '%s' saved." % p.name
dataset/ETHPy150Open SpriteLink/NIPAP/nipap-cli/nipap_cli/nipap_cli.py/pool_attr_add