code: def get_public_ip_validator():
      
      from msrestazure.tools import is_valid_resource_id, resource_id
  
      def simple_validator(cmd, namespace):
          if namespace.public_ip_address:
              is_list = isinstance(namespace.public_ip_address, list)
  
              def _validate_name_or_id(public_ip):
                  # determine if public_ip_address is name or ID
                  is_id = is_valid_resource_id(public_ip)
                  return public_ip if is_id else resource_id(
                      subscription=get_subscription_id(cmd.cli_ctx),
                      resource_group=namespace.resource_group_name,
                      namespace='Microsoft.Network',
                      type='publicIPAddresses',
                      name=public_ip)
  
              if is_list:
                  for i, public_ip in enumerate(namespace.public_ip_address):
                      namespace.public_ip_address[i] = _validate_name_or_id(public_ip)
              else:
                  namespace.public_ip_address = _validate_name_or_id(namespace.public_ip_address)
  
      return simple_validator
docs: Retrieves a validator for public IP address. Accepting all defaults will perform a check
      for an existing name or ID with no ARM-required -type parameter.