# Path: capirca/lib/gcp.py
# class Error(Exception):
# class TermError(Error):
# class HeaderError(Error):
# class UnsupportedFilterTypeError(Error):
# class Term(aclgenerator.Term):
# class GCP(aclgenerator.ACLGenerator):
#   _ALLOW_PROTO_NAME = frozenset(
#       ['tcp', 'udp', 'icmp', 'esp', 'ah', 'ipip', 'sctp',
#        'all'
#       ])
#   _GOOD_DIRECTION = ['INGRESS', 'EGRESS']
#   def _GetPorts(self):
#   def _GetLoggingSetting(self):
#   def __str__(self):
# def IsDefaultDeny(term):
# def IsProjectIDValid(project):
# def IsVPCNameValid(vpc):
# def TruncateString(raw_string, max_length):
# def GetIpv6TermName(term_name):
# 
# Path: capirca/lib/nacaddr.py
# def IP(ip, comment='', token='', strict=True):
# def _is_subnet_of(a, b):  # pylint: disable=invalid-name
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def AddComment(self, comment=''):
#   def supernet(self, prefixlen_diff=1):
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def supernet(self, prefixlen_diff=1):
#   def AddComment(self, comment=''):
# def _InNetList(adders, ip):
# def IsSuperNet(supernets, subnets):
# def CollapseAddrListPreserveTokens(addresses):
# def _SafeToMerge(address, merge_target, check_addresses):
# def _CollapseAddrListInternal(addresses, complements_by_network):
# def CollapseAddrList(addresses, complement_addresses=None):
# def SortAddrList(addresses):
# def RemoveAddressFromList(superset, exclude):
# def AddressListExclude(superset, excludes, collapse_addrs=True):
# class IPv4(ipaddress.IPv4Network):
# class IPv6(ipaddress.IPv6Network):
# class PrefixlenDiffInvalidError(ipaddress.NetmaskValueError):


import copy
import re
from typing import Dict, Any
from absl import logging
from capirca.lib import gcp
from capirca.lib import nacaddr
          filter_options.remove(opt)
          break
        except ValueError:
          continue

      if max_cost > 65536:
        raise gcp.HeaderError(
            'Default maximum cost cannot be higher than 65536')

      if previous_max_cost != -1 and previous_max_cost != max_cost:
        raise gcp.HeaderError(
            'Maximum costs of each policy specified must be equal. '
            'Unequal costs found: %d and %d' % (previous_max_cost, max_cost))

      policies_max_cost = max_cost
      previous_max_cost = max_cost

      display_name = ApiVersionSyntaxMap.SYNTAX_MAP[api_version]['display_name']

      # Get policy name and validate it to meet displayName requirements.
      policy_name = header.FilterName(self._PLATFORM)
      if not policy_name:
        raise gcp.HeaderError(
            'Policy name was not specified in header')
      filter_options.remove(policy_name)
      if len(policy_name) > 63:
        raise gcp.HeaderError(
            'Policy name "%s" is too long; the maximum number of characters '
            'allowed is 63' % (policy_name))
      if not bool(re.match('^[a-z]([-a-z0-9]*[a-z0-9])?$', policy_name)):

# Path: capirca/lib/gcp.py
# class Error(Exception):
# class TermError(Error):
# class HeaderError(Error):
# class UnsupportedFilterTypeError(Error):
# class Term(aclgenerator.Term):
# class GCP(aclgenerator.ACLGenerator):
#   _ALLOW_PROTO_NAME = frozenset(
#       ['tcp', 'udp', 'icmp', 'esp', 'ah', 'ipip', 'sctp',
#        'all'
#       ])
#   _GOOD_DIRECTION = ['INGRESS', 'EGRESS']
#   def _GetPorts(self):
#   def _GetLoggingSetting(self):
#   def __str__(self):
# def IsDefaultDeny(term):
# def IsProjectIDValid(project):
# def IsVPCNameValid(vpc):
# def TruncateString(raw_string, max_length):
# def GetIpv6TermName(term_name):
# 
# Path: capirca/lib/nacaddr.py
# def IP(ip, comment='', token='', strict=True):
# def _is_subnet_of(a, b):  # pylint: disable=invalid-name
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def AddComment(self, comment=''):
#   def supernet(self, prefixlen_diff=1):
#   def __init__(self, ip_string, comment='', token='', strict=True):
#   def subnet_of(self, other):
#   def supernet_of(self, other):
#   def __deepcopy__(self, memo):
#   def supernet(self, prefixlen_diff=1):
#   def AddComment(self, comment=''):
# def _InNetList(adders, ip):
# def IsSuperNet(supernets, subnets):
# def CollapseAddrListPreserveTokens(addresses):
# def _SafeToMerge(address, merge_target, check_addresses):
# def _CollapseAddrListInternal(addresses, complements_by_network):
# def CollapseAddrList(addresses, complement_addresses=None):
# def SortAddrList(addresses):
# def RemoveAddressFromList(superset, exclude):
# def AddressListExclude(superset, excludes, collapse_addrs=True):
# class IPv4(ipaddress.IPv4Network):
# class IPv6(ipaddress.IPv6Network):
# class PrefixlenDiffInvalidError(ipaddress.NetmaskValueError):


# Path: capirca/lib/gcp_hf.py
import copy
import re
from typing import Dict, Any
from absl import logging
from capirca.lib import gcp
from capirca.lib import nacaddr

          filter_options.remove(opt)
          break
        except ValueError:
          continue

      if max_cost > 65536:
        raise gcp.HeaderError(
            'Default maximum cost cannot be higher than 65536')

      if previous_max_cost != -1 and previous_max_cost != max_cost:
        raise gcp.HeaderError(
            'Maximum costs of each policy specified must be equal. '
            'Unequal costs found: %d and %d' % (previous_max_cost, max_cost))

      policies_max_cost = max_cost
      previous_max_cost = max_cost

      display_name = ApiVersionSyntaxMap.SYNTAX_MAP[api_version]['display_name']

      # Get policy name and validate it to meet displayName requirements.
      policy_name = header.FilterName(self._PLATFORM)
      if not policy_name:
        raise gcp.HeaderError(
            'Policy name was not specified in header')
      filter_options.remove(policy_name)
      if len(policy_name) > 63:
        raise gcp.HeaderError(
            'Policy name "%s" is too long; the maximum number of characters '
            'allowed is 63' % (policy_name))
      if not bool(re.match('^[a-z]([-a-z0-9]*[a-z0-9])?$', policy_name)):

        raise gcp.HeaderError(