def add_pool(arg, opts, shell_opts):
p = Pool()<EOL>p.name = opts.get('<STR_LIT:name>')<EOL>p.description = opts.get('<STR_LIT:description>')<EOL>p.default_type = opts.get('<STR_LIT>')<EOL>p.ipv4_default_prefix_length = opts.get('<STR_LIT>')<EOL>p.ipv6_default_prefix_length = opts.get('<STR_LIT>')<EOL>if '<STR_LIT>' in opts:<EOL><INDENT>tags = list(csv.reader([opts.get('<STR_LIT>', '<STR_LIT>')], escapechar='<STR_LIT:\\>'))[<NUM_LIT:0>]<EOL>p.tags = {}<EOL>for tag_name in tags:<EOL><INDENT>tag = Tag()<EOL>tag.name = tag_name<EOL>p.tags[tag_name] = tag<EOL><DEDENT><DEDENT>for avp in opts.get('<STR_LIT>', []):<EOL><INDENT>try:<EOL><INDENT>key, value = avp.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>print("<STR_LIT>" % avp, file=sys.stderr)<EOL>return<EOL><DEDENT>p.avps[key] = value<EOL><DEDENT>try:<EOL><INDENT>p.save()<EOL><DEDENT>except pynipap.NipapError as exc:<EOL><INDENT>print("<STR_LIT>" % str(exc), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>print("<STR_LIT>" % (p.name))<EOL>
Add a pool.