'Attach firewall policy to a public NIC interface on the server.
:param policy: Firewall policy to attach.
:type policy: :class:`.CloudSigmaFirewallPolicy`
:param node: Node to attach policy to.
:type node: :class:`libcloud.compute.base.Node`
:param nic_mac: Optional MAC address of the NIC to add the policy to.
If not specified, first public interface is used
instead.
:type nic_mac: ``str``
:return: Node object to which the policy was attached to.
:rtype: :class:`libcloud.compute.base.Node`'

def ex_attach_firewall_policy(self, policy, node, nic_mac=None):

    nics = copy.deepcopy(node.extra.get('nics', []))
    if nic_mac:
        nic = [n for n in nics if (n['mac'] == nic_mac)]
    else:
        nic = nics
    if (len(nic) == 0):
        raise ValueError('Cannot    find    the    NIC    interface    to    attach    a    policy    to')
    nic = nic[0]
    nic['firewall_policy'] = policy.id
    params = {'nics': nics}
    node = self.ex_edit_node(node=node, params=params)
    return node
