code: def is_public_ip(ip):
      '''
      Determines whether an IP address falls within one of the private IP ranges
      '''
      if ':' in ip:
          # ipv6
          if ip.startswith('fe80:'):
              # ipv6 link local
              return False
          return True
      addr = ip_to_int(ip)
      if 167772160 < addr < 184549375:
          # 10.0.0.0/8
          return False
      elif 3232235520 < addr < 3232301055:
          # 192.168.0.0/16
          return False
      elif 2886729728 < addr < 2887778303:
          # 172.16.0.0/12
          return False
      elif 2130706432 < addr < 2147483647:
          # 127.0.0.0/8
          return False
      return Truf is_public_ip(ip):
      '''
      Determines whether an IP address falls within one of the private IP ranges
      '''
      if ':' in ip:
          # ipv6
          if ip.startswith('fe80:'):
              # ipv6 link local
              return False
          return True
      addr = ip_to_int(ip)
      if 167772160 < addr < 184549375:
          # 10.0.0.0/8
          return False
      elif 3232235520 < addr < 3232301055:
          # 192.168.0.0/16
          return False
      elif 2886729728 < addr < 2887778303:
          # 172.16.0.0/12
          return False
      elif 2130706432 < addr < 2147483647:
          # 127.0.0.0/8
          return False
      return True
docs: Determines whether an IP address falls within one of the private IP ranges