@click.command()
@click.argument('identifier')
@environment.pass_env
def cli(env, identifier):
    """Edit firewall rules."""

    mgr = SoftLayer.FirewallManager(env.client)

    firewall_type, firewall_id = firewall.parse_id(identifier)
    if firewall_type == 'vlan':
        orig_rules = mgr.get_dedicated_fwl_rules(firewall_id)
    else:
        orig_rules = mgr.get_standard_fwl_rules(firewall_id)
    # open an editor for the user to enter their rules
    edited_rules = open_editor(rules=orig_rules)
    env.out(edited_rules)
    if formatting.confirm("Would you like to submit the rules. "
                          "Continue?"):
        while True:
            try:
                rules = parse_rules(edited_rules)
                if firewall_type == 'vlan':
                    rules = mgr.edit_dedicated_fwl_rules(firewall_id,
                                                         rules)
                else:
                    rules = mgr.edit_standard_fwl_rules(firewall_id,
                                                        rules)
                break
            except (SoftLayer.SoftLayerError, __HOLE__) as error:
                env.out("Unexpected error({%s})" % (error))
                if formatting.confirm("Would you like to continue editing "
                                      "the rules. Continue?"):
                    edited_rules = open_editor(content=edited_rules)
                    env.out(edited_rules)
                    if formatting.confirm("Would you like to submit the "
                                          "rules. Continue?"):
                        continue
                    else:
                        raise exceptions.CLIAbort('Aborted.')
                else:
                    raise exceptions.CLIAbort('Aborted.')
                env.fout('Firewall updated!')
    else:
        raise exceptions.CLIAbort('Aborted.')
dataset/ETHPy150Open softlayer/softlayer-python/SoftLayer/CLI/firewall/edit.py/cli