Remove attributes from a prefix

def pool_attr_remove(arg, opts, shell_opts):
    """ Remove attributes from a prefix
    """

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

    p = res[0]

    for key in opts.get('extra-attribute', []):
        if key not in p.avps:
            print("Unable to remove extra-attribute: '%s' does not exist." % key, file=sys.stderr)
            sys.exit(1)

        del p.avps[key]

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

    print("Pool '%s' saved." % p.name)