code: def is_ipv4_available():
      
      try:
          socket.socket(socket.AF_INET).close()
      except socket.error:
          return False
      return True
docs: Check if IPv4 is available.
  
      :Return: `True` when an IPv4 socket can be created.